【问题标题】:JomSocial User Points Required需要 JomSocial 用户积分
【发布时间】:2013-04-16 12:57:17
【问题描述】:

我正在尝试让 JomSocial 2.8 中的 UserPoints 系统像积分一样工作。我想要求一定数量的积分才能使用规则。现在他们有给予和扣除积分,但没有要求一定数量的选项。

谁能指导我解决这个问题。我正在寻找插件/扩展或关于如何开发它的逻辑的想法。我是一名前端开发人员,具有 PHP 知识,因此不胜感激!

【问题讨论】:

    标签: points jomsocial


    【解决方案1】:

    在很少的帮助下,我找到了一个与 jomsocial 和 kunena 集成的 joomla 插件。它被称为 AlphaUserPoints - www.alphaplug.com 一切以及我需要的许多扩展。希望这对某人有帮助!

    编辑:这并没有与 jomsocial 完全集成,这意味着大多数没有足够积分的操作都不起作用。它们由 ajax 调用,并且不被 aup 组件及时看到以停止操作。

    【讨论】:

      【解决方案2】:

      我知道这是一个老问题,但我最近也有同样的需求。看了几天后,我决定自己弄清楚。其中大部分来自 AUP 文档,因此您可以执行以下操作: Jomsocial 4.2 - 最新版本 打开 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;
              }
      

      现在转到您的语言/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 的可安装 PLUGIN,那就太棒了。
      我希望这对其他人有帮助!

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2016-04-02
        • 2021-02-23
        • 2013-02-08
        • 2012-04-14
        • 1970-01-01
        相关资源
        最近更新 更多