Welcome to Geeklog, Anonymous Saturday, March 02 2024 @ 09:51 pm EST

Geeklog Forums

Return the group a user must belongs to access an item

Status: offline


Forum User
Full Member
Registered: 01/14/05
Posts: 1569
Location:la rochelle, France

The scenario: We have an item witch can be only read by "my_private" group and we want to display the group the user must belongs to access this item

Text Formatted Code

// Ensure user has the rights to access this item
if (!SEC_hasAccess($A['owner_id'], $A['group_id'], $A['perm_owner'],
            $A['perm_group'], $A['perm_members'], $A['perm_anon']) == 3) {
    $display .= COM_startBlock ($LANG_LOGIN[1], '',
                                COM_getBlockTemplate ('_msg_block', 'header'));
    $login = new Template($_CONF['path_layout'] . 'submit');
    $login->set_file (array ('login'=>'submitloginrequired.thtml'));
    $login->set_var ( 'xhtml', XHTML );
        if ($A['perm_members'] == 2) {
        $login->set_var ('login_message', $LANG_LOGIN[2]);
        } else {
            $login->set_var ('login_message', $LANG_MY_PLUGIN_1['you_must_belong_to'] . ' ' . SEC_getGroupDropdown($A['group_id'], $access = ''));
            //You could also provide a link to your group registration page
    $login->set_var ('site_url', $_CONF['site_url']);
    $login->set_var ('site_admin_url', $_CONF['site_admin_url']);
    $login->set_var ('layout_url', $_CONF['layout_url']);
    $login->set_var ('lang_login', $LANG_LOGIN[3]);
    $login->set_var ('lang_newuser', $LANG_LOGIN[4]);
    $login->parse ('output', 'login');
    $display .= $login->finish ($login->get_var('output'));
    $display .= COM_endBlock (COM_getBlockTemplate ('_msg_block', 'footer'));
} else {
        //display item
echo $display;


Edit : Todo Check if the user is yet log in.
I'm available to customise your themes or plugins for your Geeklog CMS

All times are EST. The time is now 09:51 pm.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content