Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: Different FAQs for different user groups?  (Read 3789 times)

0 Members and 1 Guest are viewing this topic.

jenepherre

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Gender: Female
  • Posts: 54
  • there's beauty in the breakdown
Different FAQs for different user groups?
« on: April 11, 2011, 01:49:48 am »

Is this possible? How and what would I add to make one FAQ visible for guests and registered users, and another FAQ visible for admin and my custom group "contributors?"

Thanks in advance.
Logged
=================================
Jen Robertson
=================================
I don't want to explain, I just want to dance.

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15765
Re: Different FAQs for different user groups?
« Reply #1 on: April 11, 2011, 10:54:47 am »

Regarding to your other thread, I'd simply create a new array with FAQs in your language files (e.g. $lang_faq_data_guests_registered). Now you have to edit faq.php to add a check which faq_data array should be used. Find
Code: [Select]
foreach($lang_faq_data as $element) {and above, add
Code: [Select]
if ($USER_DATA['group_name'] == 'Guests' || $USER_DATA['group_name'] == 'Registered') {
    $lang_faq_data = $lang_faq_data_guests_registered;
}
Logged

jenepherre

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Gender: Female
  • Posts: 54
  • there's beauty in the breakdown
Re: Different FAQs for different user groups?
« Reply #2 on: April 12, 2011, 01:42:31 pm »

Regarding to your other thread, I'd simply create a new array with FAQs in your language files (e.g. $lang_faq_data_guests_registered). Now you have to edit faq.php to add a check which faq_data array should be used. Find
Code: [Select]
foreach($lang_faq_data as $element) {and above, add
Code: [Select]
if ($USER_DATA['group_name'] == 'Guests' || $USER_DATA['group_name'] == 'Registered') {
    $lang_faq_data = $lang_faq_data_guests_registered;
}

It took me a little playing around to figure that out, but I did and it works. Problem is, what I should have said is that I'd like Contributors and Admins to be able to see the entire FAQ, and Guests and Registered Users to only be able to see a portion of it. I guess I could include the part I want everyone to see twice - once for each pair of groups. Is there a better way to do that?

Again, thanks so much for your help, André.
Logged
=================================
Jen Robertson
=================================
I don't want to explain, I just want to dance.

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15765
Re: Different FAQs for different user groups?
« Reply #3 on: April 12, 2011, 03:06:39 pm »

I'd like Contributors and Admins to be able to see the entire FAQ, and Guests and Registered Users to only be able to see a portion of it.
In that case we should take another approach. Instead of creating 2 FAQs, just create 1 FAQ and remove the desired array elements for guests and registered users with the unset function.
Logged

jenepherre

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Gender: Female
  • Posts: 54
  • there's beauty in the breakdown
Re: Different FAQs for different user groups?
« Reply #4 on: April 13, 2011, 06:52:46 am »

In that case we should take another approach. Instead of creating 2 FAQs, just create 1 FAQ and remove the desired array elements for guests and registered users with the unset function.

I did some searching around, hoping I could figure out how to use the unset function without bothering you again... but without an actual example of the code, I just have no idea what to do. PHP is so frustrating for me. I get html and css, but PHP is just beyond my comprehension. ??? Can you tell me what I need to add, and where?

Thanks in advance, again.
Logged
=================================
Jen Robertson
=================================
I don't want to explain, I just want to dance.

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15765
Re: Different FAQs for different user groups?
« Reply #5 on: April 13, 2011, 09:24:32 am »

Do you have multi-language FAQs or do you use just 1 language? Please post your $lang_faq_data array and tell me which elements should be removed for guests and registered users.
Logged

jenepherre

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Gender: Female
  • Posts: 54
  • there's beauty in the breakdown
Re: Different FAQs for different user groups?
« Reply #6 on: April 13, 2011, 10:46:55 am »

Just English. No other languages. This is what I have right now, though I'll probably add more to the Contributor FAQ section later. Just the Contributor FAQ section at the end needs to be hidden from guests and registered users.

Code: [Select]
// ------------------------------------------------------------------------- //
// File faq.php
// ------------------------------------------------------------------------- //


if (defined('FAQ_PHP')) $lang_faq_php = array(
  'faq' => 'Frequently Asked Questions',
  'toc' => 'Table of contents',
  'question' => 'Question: ',
  'answer' => 'Answer: ',
);

if (defined('FAQ_PHP')) $lang_faq_data = array(
  'Registration and Site Features',
  array('Do I need to register?', 'Registration is not required to view and download files here, but you will need to register if you would like to leave comments or mark items as favorites.', 'allow_user_registration', '1'),
  array('How do I register?', 'Go to &quot;Register&quot; and fill out the required fields (and the optional ones if you want to).<br />After submitting your information you should recieve an email message at the address that you registered with, giving you instructions on how to activate your membership. Your membership must be activated in order for you to login.', 'allow_user_registration', '1'), //cpg1.4
  array('How do I login?', 'Go to &quot;Login&quot; and enter your username and password. Optionally, you can check &quot;Remember Me&quot; so you will be logged in on the site if you should leave it.<br /><b>IMPORTANT:Cookies must be enabled and the cookie from this site must not be deleted in order to use &quot;Remember Me&quot;.</b>', 'offline', 0),
  array('Why can I not login?', 'Did you register and click the link that was sent to you via email?. The link will activate your account. For other login problems contact the site administrator.', 'offline', 0),
  array('What if I forgot my password?', 'On the login page, there is a link for retrieving lost passwords. You can also have a new activation code sent to you in case you missed your original activation email. If you still need help logging in, contact the site administrator.', 'offline', 0),
  array('What if I changed my email address?', 'Simply login and change your email address through &quot;Profile&quot;', 'offline', 0),
  array('How do I save an item to &quot;My Favorites&quot;?', 'Click on a picture and click on the &quot;picture info&quot; link (<img src="images/info.gif" width="16" height="16" border="0" alt="Picture information" />); scroll down to the picture information set and click &quot;Add to fav&quot;.<br />IMPORTANT:Cookies must be enabled and the cookie from this site must not be deleted.', 'offline', 0),
  array('How do I rate a file?', 'Click on a thumbnail and underneath it, click the number of stars you think it deserves.', 'offline', 0),
  array('How do I post a comment for a picture?', 'Click on a thumbnail and go to the bottom and post a comment.', 'offline', 0),
 
 'Navigating the Site',
  array('What\'s &quot;Album List&quot;?', 'This will show you the entire category you are currently in, with a link to each album. If you are not in a category, it will show you the entire gallery with a link to each category. Thumbnails may be a link to the category.', 'offline', 0),
  array('What\'s &quot;Last Uploads&quot;?', 'This feature shows the most recent uploads to the site.', 'offline', 0),
  array('What\'s &quot;Last Comments&quot;?', 'This feature shows the most recent comments on items on the site.', 'offline', 0),
  array('What\'s &quot;Most Viewed&quot;?', 'This feature shows the most viewed files by all users (whether logged in or not).', 'offline', 0),
  array('What\'s &quot;Top Rated&quot;?', 'This feature shows the top rated files rated by the users, showing the average rating (e.g: five users each gave a <img src="images/rating3.gif" width="65" height="14" border="0" alt="" />: the file would have an average rating of <img src="images/rating3.gif" width="65" height="14" border="0" alt="" /> ;Five users rated the file from 1 to 5 (1,2,3,4,5) would result in an average <img src="images/rating3.gif" width="65" height="14" border="0" alt="" /> .)<br />The ratings go from <img src="images/rating5.gif" width="65" height="14" border="0" alt="best" /> (best) to <img src="images/rating0.gif" width="65" height="14" border="0" alt="worst" /> (worst).', 'offline', 0),
  array('What\'s &quot;My Favorites&quot;?', 'This feature will let a registered user store a favorite file in the cookie that was sent to your computer.', 'offline', 0),

'Downloading Files and using them in Pocket Frogs',
array('How do I download a file?', 'Just click on the thumbnail image, and the zip or rar file will download for you.', 'offline', 0),
array('How do I add my custom item into Pocket Frogs?', 'Please see PocketFrogPrince\'s tutorial <a href="http://www.youtube.com/watch?v=ZdH6XT3GPHw">here</a>.', 'offline', 0),
array('My custom content still doesn\'t work! Help!', 'Please go to the <a href="http://www.facebook.com/CustomFrogsCollective">Custom Frogs Collective Facebook page</a> and post your question. Give as much detail as you can - what you were trying to add, what your device is, etc.', 'offline', 0),
);

if (defined('FAQ_PHP')) $lang_faq_data_contributors_administrators = array(
'Contributor FAQ',
  array('How do I upload a file?', 'Go to &quot;Upload&quot;and select the album that you want to upload to. Click &quot;Browse,&quot; find the zip or rar file to upload, and click &quot;open.&quot; Add a title and description if you want. Once uploaded, look for the Custom Thumbnail button under the default thumbnail. Click on that to upload your custom thumbnail, which may be up to 300px on the largest side. ', 'allow_private_albums', 1), //cpg1.4
  array('Where do I upload a picture to?', 'The site administrator will create an album for you in whichever category you need one in.', 'allow_private_albums', 0),
  array('What type and size of a file can I upload?', 'Files should be in either zip or rar format, and be no greater than 10mb. Thumbnail images can be png, jpg or gif with a max aspect of 300px.', 'offline', 0),
);

I really appreciate you taking the time to help me with this.  :)
Logged
=================================
Jen Robertson
=================================
I don't want to explain, I just want to dance.

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15765
Re: Different FAQs for different user groups?
« Reply #7 on: April 13, 2011, 11:10:36 am »

If you only use one language for the FAQs, I suggest to directly store the content in the faq.php file. So you don't have to modify language files after an upgrade.

I initially thought that you want to remove just single lines from the FAQ. Your current code looks like you want to have a FAQ for everyone, and for some groups add one (or more) block(s). If so, we can simply use array_merge to extend the FAQ for contributors.


I added my above suggestions to the attached file.
Logged

jenepherre

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Gender: Female
  • Posts: 54
  • there's beauty in the breakdown
Re: Different FAQs for different user groups?
« Reply #8 on: April 13, 2011, 12:02:06 pm »

André, you are a genius and a gentleman. It does make more sense to have the content in the faq.php file in this case, and it works perfectly. Thank you so much for being patient with me, and for all of your help. Another issue I can mark "solved" thanks to you!  :)
Logged
=================================
Jen Robertson
=================================
I don't want to explain, I just want to dance.
Pages: [1]   Go Up
 

Page created in 0.022 seconds with 20 queries.