我正在尝试让JomSocial 2.8中的UserPoints系统像credits一样工作。我希望需要一定数量的分数才能使用规则。现在他们有给予和扣分,但没有选择要求一定的金额。
有没有人能帮我找到一个解决方案。我正在寻找一个插件/扩展或一个关于如何开发它的逻辑的想法。我是一个前端开发人员与PHP的知识,所以任何帮助是感激的!
发布于 2013-04-17 03:31:11
在没有什么帮助的情况下,我找到了joomla的一个插件,它集成了jomsocial和kunena。它被称为AlphaUserPoints - www.alphaplug.com everything,而且比我需要的更多,有很多扩展。希望这对某些人有帮助!
编辑:这没有与jomsocial完全集成,这意味着大多数没有足够点数的操作都不起作用。它们由ajax调用,aup组件不能及时看到它们来停止操作。
发布于 2016-05-11 01:42:14
我知道这是一个老生常谈的问题,但我最近也有同样的需求。在四处看了几天后,我决定自己弄清楚。其中大部分来自AUP文档,所以这是您要做的: Jomsocial 4.2 -最新发布的Open components/com_community/controllers/photos.php,大约在2924行之后
$preMessage = '';
if (CLimitsLibrary::exceedDaily('photos', $my->id)) {
$preMessage = JText::_('COM_COMMUNITY_PHOTOS_LIMIT_PERDAY_REACHED');
$disableUpload = true;
} else {
$preMessage = JText::_('COM_COMMUNITY_PHOTOS_DEFAULT_UPLOAD_NOTICE');
$disableUpload = false;
}添加:
//AlphaUserPoints start
$api_AUP = JPATH_SITE.DS.'components'.DS.'com_alphauserpoints'.DS.'helper.php';
if ( file_exists($api_AUP))
{
require_once ($api_AUP);
}
//Alphauserpoints Get user points
$user = & JFactory::getUser();
$userid = $user->id ;
$totalPoints = AlphaUserPointsHelper::getCurrentTotalPoints( '', $userid );
// Function to check if enough points
if ($totalPoints < 5) { // enter your Points Cost per Upload
$preMessage = JText::_('COM_COMMUNITY_PHOTOS_LIMIT_POINTS_REACHED');
$disableUpload = true;
} else {
$preMessage = JText::_('COM_COMMUNITY_PHOTOS_POINTS_UPLOAD_NOTICE');
$disableUpload = false;
}现在转到第61601行-查找:
if ($my->id == 0) {
$tokenId = $jinput->request->get('token', '', 'NONE');
$userId = $jinput->request->get('uploaderid', '', 'NONE');
$my = CFactory::getUserFromTokenId($tokenId, $userId);
$session = JFactory::getSession();
$session->set('user', $my);
}添加到以下位置:
//AlphaUserPoints start
$api_AUP = JPATH_SITE.DS.'components'.DS.'com_alphauserpoints'.DS.'helper.php';
if ( file_exists($api_AUP))
{
require_once ($api_AUP);
}
//Alphauserpoints Get user points
$user = & JFactory::getUser();
$userid = $user->id ;
$totalPoints = AlphaUserPointsHelper::getCurrentTotalPoints( '', $userid );
if (CLimitsLibrary::exceedDaily('photos', $my->id)) {
$this->_showUploadError(true, JText::_('COM_COMMUNITY_PHOTOS_LIMIT_PERDAY_REACHED'));
return;
}
// Function to check if enough points
if ($totalPoints < 5) {
$this->_showUploadError(true, JText::_('COM_COMMUNITY_PHOTOS_LIMIT_POINTS_REACHED'));
return;
}现在转到您的langauge/en-GB/en-GB.com_community.ini文件,添加到任何位置:
COM_COMMUNITY_PHOTOS_LIMIT_POINTS_REACHED="You do not have enough points to upload images. Images are 5 points each."将您的消息更改为您收取的任何积分。还要确保调整代码中的点数。您还可以将此代码改编并用于视频上传或文件上传。
如果有人能把它做成AUP或JomSocial的可安装插件,那就太棒了。
我希望这对其他人有帮助!
https://stackoverflow.com/questions/16037695
复制相似问题