× Warning! This forum is in archival status. New contributions may not work.
User object properties
  • Vote Up0Vote Down Daniel JamesDaniel James
    Posts: 844Member, Sourcefabric Team
    Hi devs,

    The template reference currently lists three user object properties
    which don't make much sense to me:

    # subscription: returns the first subscription assigned to this user;
    unset if the user was not a reader

    # is_admin: true if the user was not a reader

    # has_permission(<permission_name>): true if the user was not a reader
    and had the given permission


    Would it be more accurate to say the following?

    # subscription: returns the first subscription assigned to this user;
    unset if the user is a staff member

    or:

    # subscription: returns the first subscription assigned to this user;
    unset if the user is not a subscriber

    also:

    # is_admin: true if the user is a staff member and has been given the
    'Administrator' role in the Newscoop administration interface

    # has_permission(<permission_name>): true if the user is a staff member
    and has been given a specific permission in the Newscoop administration
    interface


    Thanks for all the help guys, the Cookbook is nearly ready :-)

    Cheers!

    Daniel
  • 5 Comments sorted by
  • I think that both old and new interpretations are correct, but for the sake
    of easier understanding, you may describe it your way. Maybe Mugur has
    something to add to this, dough.

    best, ljuba

    On 31 May 2011 17:58, Daniel James <newscoop-dev@lists.sourcefabric.org>wrote:

    > Hi devs,
    >
    > The template reference currently lists three user object properties
    > which don't make much sense to me:
    >
    > # subscription: returns the first subscription assigned to this user;
    > unset if the user was not a reader
    >
    > # is_admin: true if the user was not a reader
    >
    > # has_permission(<permission_name>): true if the user was not a reader
    > and had the given permission
    >
    >
    > Would it be more accurate to say the following?
    >
    > # subscription: returns the first subscription assigned to this user;
    > unset if the user is a staff member
    >
    > or:
    >
    > # subscription: returns the first subscription assigned to this user;
    > unset if the user is not a subscriber
    >
    > also:
    >
    > # is_admin: true if the user is a staff member and has been given the
    > 'Administrator' role in the Newscoop administration interface
    >
    > # has_permission(<permission_name>): true if the user is a staff member
    > and has been given a specific permission in the Newscoop administration
    > interface
    >
    >
    > Thanks for all the help guys, the Cookbook is nearly ready :-)
    >
    > Cheers!
    >
    > Daniel
    >
    >

    --
    Ljuba Rankovic
    Senior Front End Developer, Sourcefabric
    ljuba.rankovic@sourcefabric.org

    http://www.sourcefabric.org
    http://www.twitter.com/Sourcefabric
  • OK re "subscription" and "has_permission()"

    Re "is_admin" the proper description is: "true if the user was a staff
    member" - which means the user can log in to the admin interface. The user
    does not need to be administrator type. This is confusing, I know, but this
    is the current functionality.

    Mugur Rus
    Senior Software Developer, Sourcefabric
    mugur.rus@sourcefabric.org

    Cluj-Napoca, Romania
    +40 (0)720 528408
    Skype: mugur_rus

    http://www.sourcefabric.org
    http://www.twitter.com/Sourcefabric



    On Tue, May 31, 2011 at 6:58 PM, Daniel James <
    newscoop-dev@lists.sourcefabric.org> wrote:

    > Hi devs,
    >
    > The template reference currently lists three user object properties
    > which don't make much sense to me:
    >
    > # subscription: returns the first subscription assigned to this user;
    > unset if the user was not a reader
    >
    > # is_admin: true if the user was not a reader
    >
    > # has_permission(<permission_name>): true if the user was not a reader
    > and had the given permission
    >
    >
    > Would it be more accurate to say the following?
    >
    > # subscription: returns the first subscription assigned to this user;
    > unset if the user is a staff member
    >
    > or:
    >
    > # subscription: returns the first subscription assigned to this user;
    > unset if the user is not a subscriber
    >
    > also:
    >
    > # is_admin: true if the user is a staff member and has been given the
    > 'Administrator' role in the Newscoop administration interface
    >
    > # has_permission(<permission_name>): true if the user is a staff member
    > and has been given a specific permission in the Newscoop administration
    > interface
    >
    >
    > Thanks for all the help guys, the Cookbook is nearly ready :-)
    >
    > Cheers!
    >
    > Daniel
    >
    >

  • Vote Up0Vote Down Daniel JamesDaniel James
    Posts: 844Member, Sourcefabric Team
    Hi Mugur,

    I've fixed the definition of is_admin now, so the Cookbook is cooked Smile

    Cheers!

    Daniel
  • Hey what is $user->posts_count ?
  • Reply to @Tomasz+Rondio:

    posts_count is the total number of comments posted by the user plus (+) the total number of feedback messages sent by the user.