本文整理汇总了PHP中KunenaForumTopicHelper::subscribe方法的典型用法代码示例。如果您正苦于以下问题:PHP KunenaForumTopicHelper::subscribe方法的具体用法?PHP KunenaForumTopicHelper::subscribe怎么用?PHP KunenaForumTopicHelper::subscribe使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KunenaForumTopicHelper
的用法示例。
在下文中一共展示了KunenaForumTopicHelper::subscribe方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: unsubscribe
function unsubscribe() {
$app = JFactory::getApplication ();
if (! JRequest::checkToken ()) {
$app->enqueueMessage ( JText::_ ( 'COM_KUNENA_ERROR_TOKEN' ), 'error' );
$this->redirectBack ();
}
$topics = KunenaForumTopicHelper::getTopics(array_keys(JRequest::getVar('topics', array ( 0 ), 'post', 'array')));
if ( KunenaForumTopicHelper::subscribe(array_keys($topics), 0) ) {
$app->enqueueMessage ( JText::_('COM_KUNENA_USER_UNSUBSCRIBE_YES') );
} else {
$app->enqueueMessage ( JText::_('COM_KUNENA_POST_NO_UNSUBSCRIBED_TOPIC') );
}
$this->redirectBack ();
}
示例2: _unsubAll
/**
* Delete all users subscriptions
*
* @param moscomprofilerUser $user
* @param string $prefix
*/
function _unsubAll($user, $forum)
{
global $_CB_database;
if ($forum->prefix != 'kunena' || $forum->prefix == 'kunena' && !class_exists('KunenaForum')) {
$query = 'DELETE FROM ' . $_CB_database->NameQuote('#__' . $forum->prefix . '_subscriptions') . "\n WHERE " . $_CB_database->NameQuote('userid') . " = " . (int) $user->id;
$_CB_database->setQuery($query);
if (!$_CB_database->query()) {
trigger_error('CBForum-unsubAll SQL error' . $_CB_database->stderr(true), E_USER_WARNING);
}
} elseif (class_exists('KunenaForumTopicHelper')) {
$threads = array_keys(array_pop(KunenaForumTopicHelper::getLatestTopics(false, 0, 0, array('user' => (int) $user->id, 'subscribed' => true))));
if ($threads) {
KunenaForumTopicHelper::subscribe($threads, 0, (int) $user->id);
}
}
}
示例3: unsubscribe
function unsubscribe()
{
if (!JSession::checkToken('post')) {
$this->app->enqueueMessage(JText::_('COM_KUNENA_ERROR_TOKEN'), 'error');
$this->setRedirectBack();
return;
}
$ids = array_keys(JRequest::getVar('topics', array(), 'post', 'array'));
// Array of integer keys
JArrayHelper::toInteger($ids);
$topics = KunenaForumTopicHelper::getTopics($ids);
if (KunenaForumTopicHelper::subscribe(array_keys($topics), 0)) {
$this->app->enqueueMessage(JText::_('COM_KUNENA_USER_UNSUBSCRIBE_YES'));
} else {
$this->app->enqueueMessage(JText::_('COM_KUNENA_POST_NO_UNSUBSCRIBED_TOPIC'));
}
$this->setRedirectBack();
}
示例4: unSubscribe
/**
* Un-subscribe from a topic
*
* @param string|int $postid Forum Post id
* @param UserTable $user Viewed at User
* @param PluginTable $plugin Current Plugin
* @return boolean Result
*/
public static function unSubscribe($postid, $user, $plugin)
{
if (!class_exists('KunenaForumTopicHelper')) {
return false;
}
if ($postid == 'all') {
$topics = KunenaForumTopicHelper::getLatestTopics(false, 0, 0, array('user' => (int) $user->id, 'subscribed' => true));
$ids = array_keys(array_pop($topics));
} else {
$ids = array((int) $postid);
}
if (!$ids || !KunenaForumTopicHelper::subscribe($ids, 0, (int) $user->id)) {
return false;
}
return true;
}