Different FAQs for different user groups? Different FAQs for different user groups?
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

Different FAQs for different user groups?

Started by jenepherre, April 11, 2011, 01:49:48 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

jenepherre

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.
=================================
Jen Robertson
=================================
I don't want to explain, I just want to dance.

Αndré

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 foreach($lang_faq_data as $element) {
and above, add
if ($USER_DATA['group_name'] == 'Guests' || $USER_DATA['group_name'] == 'Registered') {
   $lang_faq_data = $lang_faq_data_guests_registered;
}

jenepherre

Quote from: Αndré 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 foreach($lang_faq_data as $element) {
and above, add
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é.
=================================
Jen Robertson
=================================
I don't want to explain, I just want to dance.

Αndré

Quote from: jenepherre on April 12, 2011, 01:42:31 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.

jenepherre

Quote from: Αndré on April 12, 2011, 03:06:39 PM
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.
=================================
Jen Robertson
=================================
I don't want to explain, I just want to dance.

Αndré

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.

jenepherre

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.

// ------------------------------------------------------------------------- //
// 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.  :)
=================================
Jen Robertson
=================================
I don't want to explain, I just want to dance.

Αndré

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.

jenepherre

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!  :)
=================================
Jen Robertson
=================================
I don't want to explain, I just want to dance.