Multi User Categories

5 posts by 2 authors in: Forums > CMS Builder
Last Post: October 8, 2008   (RSS)

By (Deleted User) - October 6, 2008 - edited: October 6, 2008

I have a site for hair stylists that need to post services and prices. Each stylist has different services and costs for their services. Some services may be the same or similar. I have chosen to use the Category Menu to allow them to add and edit their own services.

This works great until they go to add a service and select the parent Category. In the drop down list for the parent category, it lists all the other stylist created categories and they are choosing those instead of creating or choosing their own parent categories. For instance they are creating a subcategory 'Men's Cuts $10.00' and placing it under the parent category 'Hair Cuts' that another stylist created and it isn't showing up on their public page because I am querying for just the services that the stylist themselves created.

I would like to continue to allow them to have full control over both the Main Categories as well as the Sub Categories. I would love to see that the drop down menu for the parent categories doesn't list other user created categories. Is there a way to do this? Is there a better way for me to set this up in the CMS Builder for this functionality.

Re: [seyrich] Multi User Categories

By Dave - October 7, 2008

Hi Seyrich, welcome to the CMS Builder Forum.

The category menu isn't setup to allow per user access yet so that might be a bit of a problem.

Another way to set it up would be to have two multi record sections, one for stylists and one for services.

Are you post a sample url or mockup of the design and structure you're trying to create?
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Multi User Categories

By (Deleted User) - October 7, 2008

http://galleriaofsalons.com/stylists/

Currently there is only one stylist on the site right now. There will be more and I ran into the problem when I had 3 or 4 test stylists in the database. If you select the stylist and then the services link from the top you will see where I am trying to set this up.

I guess maybe I should ask a different way. When I created the stylist account I checked that the user is type 'writer' which should not allow her to access any records she did not create. What I found was that they do have access to records that others created in the selection box when choosing parent categories.

Thank you for a great system! I am a php/mysql programmer and have always written my own cms system for my website. This system saves me a ton of time.

Re: [seyrich] Multi User Categories

By Dave - October 7, 2008

Thanks! :)

>What I found was that they do have access to records
>that others created in the selection box when choosing
>parent categories.

Oh I see. Yes I didn't think of having writer access with category sections but that makes sense. I'll fix that for the next version. Here's the steps if you'd like to apply the fix yourself:

- Open /lib/menus/default/edit_functions.php
- Make backup copy of the file
- Search for: globalOrder
- Replace the line 2 below the matched line (in red):

$query = "SELECT * FROM $escapedTableName ORDER BY globalOrder";
$result = mysql_query($query) or die("MySQL Error: " .mysql_error(). "\n");
while ($row = mysql_fetch_assoc($result)) { $categoriesByNum[ $row['num'] ] = $row; }


With this:

$query = "SELECT * FROM $escapedTableName ORDER BY globalOrder";
$result = mysql_query($query) or die("MySQL Error: " .mysql_error(). "\n");
while ($row = mysql_fetch_assoc($result)) {
global $CURRENT_USER;
$isOwner = @$row['createdByUserNum'] == $CURRENT_USER['num'];
if (@$row['createdByUserNum'] && (!$isOwner && !$GLOBALS['hasAdminAccess'])) { continue; }
$categoriesByNum[ $row['num'] ] = $row;
}


Hope that helps! Let me know if that fixes it for you.
Dave Edis - Senior Developer
interactivetools.com