Code Monkey home page Code Monkey logo

Comments (4)

 avatar commented on June 12, 2024

The later option of checking necessary things at the layout is more desirable as it is CjBlog specific check. API applies to every other component.

from cjblog.

Ruud68 avatar Ruud68 commented on June 12, 2024

Okay agree :), that would mean changes to all views / layouts on the cjblog side. I will first come up with a change in code that we can agree upon and then (if agreed) do a PR for all the changes.

from cjblog.

Ruud68 avatar Ruud68 commented on June 12, 2024

Okay, just found out that core.pro ACL is not implemented at all, so my first observation that it was only working for the about text was NOT correct (it turned out that I tested with a user who didn't have about text :)

I propose to change it with the following logic (for the article view)
in ./plugins/content/cjblog/cjblog.php (where the about text is filled)

                        // Check if author has pro-capabilities
                        $proUser = JFactory::getUser($article->created_by)->authorise('core.pro', 'com_cjblog');

                        if (!$proUser)
                        {
                                $profile['about'] = '';
                        }
                        elseif($aboutTextApp == 'easyprofile')
                        {
                                $db = JFactory::getDbo();
                                $query = $db->getQuery(true)
                                        ->select($db->qn($db->escape($appParams->get('easyprofile_about_field', 'author_info'))).' AS about')
                                        ->from('#__jsn_users')
                                        ->where('id = '. $article->created_by);

                                $db->setQuery($query);
                                $profile['about'] = $db->loadResult();
                        }

and in ./components/com_cjblog/layouts/default/author_info.php where the link on the avatar is placed

$profileApp             = $params->get('profile_component', 'cjblog');
$avatarSize             = $params->get('article_avatar_size', 96);

// Check if author has pro-capabilities
$proUser                = JFactory::getUser($article->created_by)->authorise('core.pro', 'com_cjblog');
$userProfileUrl         = ($proUser ? $api->getUserProfileUrl($profileApp, $article->created_by) : '#');

and then for the actual generation of the avatar:

<a href="<?php echo $userProfileUrl;?>" class="thumbnail">

from cjblog.

 avatar commented on June 12, 2024

Looks good. Please send me the PR.

from cjblog.

Related Issues (7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.