Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Try Vanilla Forums Cloud product

Ready to contribute?

Amazing! Sign our contributors' agreement and then join us on GitHub.

Update for critical security issue in PHPMailer included in release Vanilla 2.3.1
Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.


This discussion is related to the CategoryRoles addon.
Max_BMax_B New
edited June 2008 in Vanilla 1.0 Help


  • I'm getting an error with the latest version of vanilla on pretty much all my pages:

    Notice: unserialize(): Argument is not an string in /var/www/vhosts/ on line 78
  • Did you add the required delegate, as explained in the readme?
  • was the delegate eventually added to vanilla
  • Nope.
    Mark never commented this delegate request and I don't know if he forgot to add it or what…
    Anyway, I'm planning to rewrite part of this extension to use the object factory instead of delegate, mostly because this would allow a much better database optimization, but I don't know when I'll have time for.
  • How will object factory solve ur problem. can u explain.
    I'm trying to make a blog extension and i really need this functionality, Ability to be commented and read by all, but posted by just one role
  • see the doc about it:
  • About your need: use CategoryRoles, adding the delegate is only a single line edit.

    About the object factory: by overloading the standard class by a custom one, I'd be able to add the required database join and save the delegate need. Also a single database request is much better than 2 or 3.
  • how will overloading a class affect future changes in the class.
    if mark adds some additional stuff to the class?
  • …the custom class must be updated accordingly. Every feature has a cost.
  • could this work?
    if ($Context->SelfUrl == "post.php") { function discussionform_hidecategory($DiscussionForm) { unset($cs->aOptions[$Configuration['APPLICATION_PATH']]); } $Context->AddToDelegate('DiscussionForm','DiscussionForm_PreCategoryRender','discussionform_hidecategory'); }

    well i obviously tried and it doesnt. probably because i dont get the $cs object. is this why you didnt use delegate?
  • $cs is a select box. in this case its a categoryselect box
    $cs->aOptions are the options
    plus its a 2D array
    aOptions = array (0 => array( idValue => "ID", DisplayValue => "Display", Attributes => ""), 1=>..........

    you should start using a php debugger.
  • Great add-on - greatly needed! I'm having a bit of a problem, tho - I am getting the same error messages as quoo above. I've added the delegate, as instructed, and am using the theme included with the package. I've cmod all CategoryRoles files/folder to 777 "just in case", and I'm still having the error messages thrown in the manage Categories pages, and where you actually read the discussions inside the Categories. I'm a bit stumped... any insight? I'd greatly appreciate it! Thanks in advance, drw
  • @drweyant: Its probably because setting are not initialized. Did you see this post?
    Anyway, I MUST correct this for long now. I'll try to do it today.
  • Uploaded version 0.6 of CategoryRoles.
  • The 0.6 version correct the initialization bug and merge with Vanilla 1.1.2 theme file.
  • Uploaded version 0.6 of CategoryRoles.
  • I'd love to get this working on my installation if someone could give me a hand? I've installed the pseudotheme, but the delegate keeps giving me errors when I add it.

    There's also a post by MySchizoBuddy in the other discussion thread that says the delegate was added into the Vanilla core? I can't see the new role based controls at all.

    Any ideas?
  • @Alty: The delegate is already there in 1.1.4 (since ?) you do not need add it.
    Did you enable the extension?
  • Yep, the extension is enabled. I am running 1.1.4 and I've removed the delegate so the forums still run. Where should I be looking for the category roles options? I assumed within the Categories page, and then clicking on a specific category. But the only options in there are Read only access // Read & Write access // No access.
  • @Alty: yes you should find it there, is the custom theme enabled also?
  • The theme I'm using is the one included with the download, so CategoryRoles-theme and I've tried it with both the default and vaneablack styles. The theme is applied to all users (since I've found that if I don't apply a theme to all users that theme is not actually applied).
  • Well, if the theme is correctly installed, please double check it, go to Settings->Categories, click to edit one category. You should find two more selectors down the page.
    Or else something is not correctly installed. We need more info.
  • Hi Max,

    It's minor, but the current readme still says you need add that delegate to CategoryForm.php, despite the fact that it was added in v.1.1.4. It would be nice if you took that out, or changed it to something along the line of "For versions below v.1.1.4, add this delegate..."
  • Oh, and another thing---you hard-code the db prefix as "LUM_". For those of us that use an alternative prefix, it would be nice if you switched that to something like:

    [ln 30] $DatabasePrefix = $Context->Configuration['DATABASE_TABLE_PREFIX']; $res = mysql_query("DESCRIBE ".$DatabasePrefix."Category Cat_filter", $Context->Database->GetConnection()) // Etc, etc. There are a few spots that hard-code "LUM_"
  • is the pseudo theme file only for editing the roles, or is it required even to limit the role comment/discussion abilities

    basically how hard would it be to use this with a different theme?
  • @fysicsluvr:
    1 - discussion_form.php is required to limit abilities. settings_category_edit.php for editing roles.

    2 - from the readme (!):
    If you want to use the extension with another theme, you can copy the two php files of this folder to you theme folder.
    If this other theme also has modification to these files, you should merge the few lines necessary to the extension.
    They are clearly marked by //CategoryRole comments.
    Only a single line (two in source because split for readability) is necessary for user side.
  • oh, i should've read the readme first! oops...
  • trying to set one of my categories to read only for a certain role"members" ( and read only on all discussion under that cat.)
    .. ( can view the category and all discussions..but can't add comments)
    but( im missing something really obivious.. iknow.)
    im perplexed
    in settings:
    under selected category, i check the roles , including "member" ( otherwise its not even visible)-
    -in the first dropdown i choose a higher role than member,"teamPuscifer" -// wishing i could leave it there.. is my issue.. the next drop down nulls my objective: it allows any checked role to add comments.( so if visibile - that role can always add comments?
    scuse my slowness.thanks
Sign In or Register to comment.