SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Jun 2013
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    NOVICE TO NINJA userHasRole($role) function confusion

    Apologies if this topic has already been answered, but a quick search yielded no solution.

    Ref: Novice to Ninja
    File: chapter9/includes/access.inc.php (pg.302)
    Function: userHasRole($role)

    Can someone please explain to me where the value for the argument ($role) comes from in this function.
    I thought values needed to be passed into functions via arguments included in the function call.
    I can't see where $role has been declared or even a value for it.

    Thanks in advance

    EM

  2. #2
    Hosting Team Leader silver trophybronze trophy
    cpradio's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    5,136
    Mentioned
    152 Post(s)
    Tagged
    0 Thread(s)
    If you scroll down to page 305, you will find this:
    PHP Code:
    if (!userHasRole('Account Administrator'))
    {
      
    $error 'Only Account Administrators may access this page.';
      include 
    '../accessdenied.html.php';
      exit();

    There you can clearly see, it will be passed a value. In this particular use, the $role used in userHasRole will contain 'Account Administrator'

  3. #3
    SitePoint Member
    Join Date
    Jun 2013
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank You cpradio. Much appreciated. I was only looking in the access.php file.
    Enjoy your day.


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •