المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : انشاء قسم و جعل الاعضاء يرون مواضيعهم فقط فيه و لا يرون مواضيع الاخرين, لا يمكن رؤية الموضوع الا من


Link Dot Net
2009-08-12, 04:50 PM
بسم الله الرحمن الرحيم


الهاك متوافق مع النسخ 2.2 و 2.3


يستخدم لعمل قسم و جعل مواضيع العضو فقط تظهر له بدون ان يرى مواضيع الاعضاء الاخرين

تستخدم مثلا عند انشاء قسم لاختبارات الاشراف http://www.d3m-vb.net/vb/images/smilies/cupidarrow.gif

الهاك طويل و يحتاج الكثير من التركيز http://www.d3m-vb.net/vb/images/smilies/cupidarrow.gif

الملفات التى سيتم التعديل عليها :


sources/action_public/forums.php
sources/classes/class_forums.php
sources/components_public/profile/posts.php
sources/components_public/profile/topics.php
skin_acp/IPB2_Standard/acp_skin_html/cp_skin_forums.php


طريقة التركيب

أولا : من لوحة تحكم الادمن ACP اذهب الى Admin

ومنها الى SQL Toolbox

و اذهب الى اخر الصفحه و اضف الامر التالى


alter table ibf_forums add is_private numeric(1) default 0;


ثم اضغط على Run Query


ثانيا : افتح الملف sources/action_admin/forums.php

وابحث عن


'upload_perms' => '',
'download_perms' => '',


واضف تحتها


//private forum setting
'is_private' => 0,


ثم ابحث عن


# Permission settings
$form['permission_showtopic'] = $this->ipsclass->adskin->form_yes_no( 'permission_showtopic' , ( isset($_POST['permission_showtopic']) AND $_POST['permission_showtopic'] ) ? $_POST['permission_showtopic'] : $forum['permission_showtopic'] );


واضف بعدها


# Private Forum setting
$form['is_private'] = $this->ipsclass->adskin->form_yes_no('is_private',(isset($_POST['is_private']) AND $_POST['is_private']) ? $_POST['is_private']: $forum['is_private']);

ثم ابحث عن


'notify_modq_emails' => $this->ipsclass->input['notify_modq_emails'],
'permission_showtopic' => intval($this->ipsclass->input['permission_showtopic']),


واضف بعدها


//private forum setting
'is_private' => intval($this->ipsclass->input['is_private']),

ثم احفظ الملف مرة اخرى و اعد رفعه http://www.d3m-vb.net/vb/images/smilies/cupidarrow.gif


ثالثـا : افتح الملف sources/action_public/forums.php

وابحث عن


if ( $topicfilter == 'ireplied' )


واضف فوقه


//turn on private forum if member is not mod
if (($this->forum['is_private']) AND ($this->ipsclass->member['is_mod'] == 0)) {
$privatequery = " AND t.starter_id=".$this->ipsclass->member['id'];
} else {
$privatequery = "";
}

ثم ابحث عن


$this->ipsclass->DB->simple_construct( array( 'select' => '*',
'from' => 'topics t',
'where' => $query . $add_query,
'order' => 't.pinned DESC, '.$topic_sort.' t.'.$sort_key .' '. $r_sort_by,
'limit' => array( intval($First), $this->ipsclass->vars['display_max_topics'] )
) );

وستبدله بـ


$this->ipsclass->DB->simple_construct( array( 'select' => '*',
'from' => 'topics t',
'where' => $query . $add_query . $privatequery,
'order' => 't.pinned DESC, '.$topic_sort.' t.'.$sort_key .' '. $r_sort_by,
'limit' => array( intval($First), $this->ipsclass->vars['display_max_topics'] )
) );


ثم احفظ الملف و اعد رفعه .


رابعا : افتح الملف sources/action_public/search.php

وابحث فى الوظيفة function

get_searchable_forums

عن


//-----------------------------------------
// Return
//-----------------------------------------

$this->searchable_forums = $final;

return implode( "," , $final );

وأضف اعلاه


//-----------------------------------------
// Remove private forums
//-----------------------------------------

$private_forums= $this->ipsclass->DB->simple_exec_query( array ('select' => 'id', 'from' => 'forums', 'where'=> 'is_private=1'));

if (is_array( $private_forums) and count( $private_forums) ) {
if (is_array($final) and count($final)){
$tmp = $final;
$final = array();
foreach ($tmp as $id) {
if (in_array($id,$private_forums)){
continue;
} else {
$final[] = $id;
}
}
}
}


ثم احفظ الملف و ارفعه مرة أخرى


خامسـا : افتح الملف sources/classes/class_forums.php

وابحث عن


$forum_data['last_post'] = $this->ipsclass->get_date($forum_data['last_post'], 'LONG');

واضف اعلاه


//change last poster info if forum is private and member is not mod
if (($forum_data['is_private'] == 1) AND !($this->ipsclass->member['g_is_supmod']) and (!isset($this->ipsclass->member['_moderator'][ $forum_data['id'] ]['post_q']) AND $this->ipsclass->member['_moderator'][ $forum_data['id'] ]['post_q'] != 1 )) {
$this->ipsclass->DB->simple_construct( array( 'select' => '*',
'from' => 'topics',
'where' => "forum_id=".$forum_data['id']." and starter_id=".$this->ipsclass->member['id'],
'order' => 'last_post DESC',
'limit' => '0,1',
) );
$this->ipsclass->DB->simple_exec();
$private_row=$this->ipsclass->DB->fetch_row();
$forum_data['last_post'] = $private_row['last_post'];
$forum_data['last_id'] = $private_row['tid'];
$forum_data['last_title'] = $private_row['title'];
$forum_data['last_poster_id'] = $private_row['last_poster_id'];
$forum_data['last_poster_name'] = $private_row['last_poster_name'];
}


ثم احفظ الملف و ارفعه مرة أخرى


سادسـا : افتح الملف sources/components_public/profile/posts.php

وابحث عن


$content .= $this->ipsclass->compiled_templates['skin_profile']->personal_portal_single_column( $row, $this->ipsclass->lang['profile_read_topic'], $this->ipsclass->base_url.'act=findpost&pid='.$row['pid'], $this->ipsclass->lang['profile_in_topic'] . $row['title'] );

واستبدله بـ


//-----------------------------------------
// check for private forums
//-----------------------------------------

$t = $this->ipsclass->DB->simple_exec_query( array ('select' => 'forum_id',
'from' => 'topics',
'where' => 'tid='.$row['topic_id']));
$f = $this->ipsclass->DB->simple_exec_query( array ('select' => 'is_private',
'from' => 'forums',
'where' => 'id='.$t['forum_id']));
if ($f['is_private'] == 1)
{
if (($this->ipsclass->member['g_is_supmod']) or ($this->ipsclass->member['id'] == $row['starter_id']))
{
$content .= $this->ipsclass->compiled_templates['skin_profile']->personal_portal_single_column( $row, $this->ipsclass->lang['profile_read_topic'], $this->ipsclass->base_url.'act=findpost&pid='.$row['pid'], $this->ipsclass->lang['profile_in_topic'] . $row['title'] );
}
} else {
$content .= $this->ipsclass->compiled_templates['skin_profile']->personal_portal_single_column( $row, $this->ipsclass->lang['profile_read_topic'], $this->ipsclass->base_url.'act=findpost&pid='.$row['pid'], $this->ipsclass->lang['profile_in_topic'] . $row['title'] );
}



ثم احفظ الملف و ارفعه مرة أخرى


سابعا : افتح الملف sources/components_public/profile/topics.php

وابحث عن


$content .= $this->ipsclass->compiled_templates['skin_profile']->personal_portal_single_column( $row, $this->ipsclass->lang['profile_read_topic'], $this->ipsclass->base_url.'act=findpost&pid='.$row['pid'], $row['title'] );

واستبدله بـ


//-----------------------------------------
// check for private forums
//-----------------------------------------

$f = $this->ipsclass->DB->simple_exec_query( array ('select' => 'is_private',
'from' => 'forums',
'where' => 'id='.$row['forum_id'] ));
if ($f['is_private'] == 1)
{
if (($this->ipsclass->member['g_is_supmod']) or ($this->ipsclass->member['id'] == $row['starter_id']))
{
$content .= $this->ipsclass->compiled_templates['skin_profile']->personal_portal_single_column( $row, $this->ipsclass->lang['profile_read_topic'], $this->ipsclass->base_url.'act=findpost&pid='.$row['pid'], $row['title'] );
}
} else {
$content .= $this->ipsclass->compiled_templates['skin_profile']->personal_portal_single_column( $row, $this->ipsclass->lang['profile_read_topic'], $this->ipsclass->base_url.'act=findpost&pid='.$row['pid'], $row['title'] );
}


واحفظ الملف و ارفعه مرة أخرى


ثامنا : افتح الملف skin_acp/IPB2_Standard/acp_skin_html/cp_skin_forums.php

وابحث عن


<tr>
<td width='40%' class='tablerow1'><strong>Allow members who can see the forum but cannot read topics to see the topic list</strong><div class='desctext'>If yes, the member will be able to see the topic titles but will not be able to read the topic posts when clicked.</div></td>
<td width='60%' class='tablerow2'>{$form['permission_showtopic']}</td>
</tr>



و اضف اسفلها


<tr>
<td width='40%' class='tablerow1'><strong>Private Forum?</strong></td>
<td width='60%' class='tablerow2'>{$form['is_private']}</td>
</tr>




انتهى و بالتوفيق :cool: