FAQ (Frequently Asked Questions) mod

Started by Suki, June 20, 2011, 08:19:18 PM

Previous topic - Next topic

Suki

If you just want to move the FAQ button next to the serach button, the mod itself has a setting to do so without having to edit any file.
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

Skaty

this is exactly what i need, thank you so much :)

Skaty

is there i way to do permissions for members they just can add new faq not to delete them ?

Suki

Create a new permission (there is a tutorial somewhere here) and then modify both methods FaqAdd() and FaqAdd2() in Sources/Faq.php   change this line:

isAllowedTo('faqperedit');

And replace it with your new permission.
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

Skaty

http://www.simplemachines.org/community/index.php?topic=438980.msg3125341#msg3125341

Checked twice and i think i do all right, but didn't show up the add faq button for members. Also something is wrong in the permissions area too.



Suki

Did you add the correct language strings?

Make sure you properly add the correct language strings, see your error log to see an undefined error, that error will indicate the correct language string SMF is looking for.
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

Skaty

yes, i just have Faq.english.php so i add it here.

There is no log for faq in my error page.

here is my files if you can look at them.

Suki

Ok, you have the cannot_ text string:

$txt['cannot_faqperadd']

But you also need to add the actual permission text string, add this on your Faq.english.php file:

$txt['permissionname_faqperadd'] = 'Add FAQs';
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

Skaty

i was mixed up a word  :-[
$txt['permissionname_faqpereadd'] = 'Add FAQs';

fix it, now there is no problem in permission page. but the add faq button still is not showing up for regular members, i give them the a permissions.


Suki

Does following the direct url works?  ie, type the url directly to the browser and hit enter, if so, you only need to change the if  in Faq.template.php:


// Add a  new FAQ
if($context['faqperedit'])
echo '
<div id="confirm_buttons">
<form action="', $scripturl, '?action=faq;sa=add" method="post" target="_self">
<input type="submit" name="send" class="sbtn" value="',$txt['faqmod_add_send'],'" />
</form>
</div>';


To your own permission.
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

Skaty

#330
Quote from: Suki on January 16, 2013, 11:47:16 AM
Does following the direct url works?  ie, type the url directly to the browser and hit enter, if so, you only need to change the if  in Faq.template.php:


// Add a  new FAQ
if($context['faqperedit'])
echo '
<div id="confirm_buttons">
<form action="', $scripturl, '?action=faq;sa=add" method="post" target="_self">
<input type="submit" name="send" class="sbtn" value="',$txt['faqmod_add_send'],'" />
</form>
</div>';


To your own permission.

i have this codes. i can add faqs and everything but the regular members can't. i give them permission but the button doesnt show up.

Suki

Of course you have that, thats from a vanilla faq file.

You need to change that to your own permission:

if($context['faqperedit'])

to

allowedto('permission_name')

Dunno if it was allowedto or the other one, can't remember since it has been a while since I look at those functions, in the function DB you will find more info about it.
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

Skaty

well i'm confused so bad :D i think i'm not gonna give them this permission :D sorry for all of this question, i guess i'm missing a something very easy.


the direct link is openin work regular member: action=faq;sa=add   but when send it, it gave an error that you can not. and then the faq is showing, it is actually accept it.

and again the button is not shown :D



can i give you the files that you need and you can check it :)

Suki

Its not difficult for someone who is familiar with the code, unfortunately, or rather, very fortunately, I've been away from SMF code for weeks now, even months, learning new ways to code.

I have to go back to SMF code to add some permissions to another mod I'm building, when I get to it I'll post some proper instructions.
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

MissyNL

Hi.. this is a great mod :) However... how do you make categories? Because i have been searching but i really can not find it...
Sorry for my poor English, but i think it's probably better then your Dutch :)

Suki

As an admin, you can hover the Faq button in the main menu, this will show some submenus, one of them takes you to the create a category section.
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

iain sherriff

hi. Just put your mod in on  a test site isthatagnu.com/smf
thanks
I'm getting errors in the log which I think are down to other mods.


Apply Filter: Only show the error messages of this URL
http://*.com/smf/index.php?action=faq;sa=add
Apply Filter: Only show the errors with the same message
8: Undefined index: active_button
Apply Filter: Only show the errors from this file
File: /*.com/smf/Themes/default/languages/SearchFocus.english.php (body_above sub template - eval?)
Line: 441


Apply Filter: Only show the error messages of this URL
http://*.com/smf/index.php?action=admin;area=faqdmin;sa=basic
Apply Filter: Only show the errors with the same message
8: Undefined index: active_button
Apply Filter: Only show the errors from this file
File: /*.com/smf/Themes/default/languages/SearchFocus.english.php (body_above sub template - eval?)
Line: 441


Do you know what I should do?
:)
SMF 2.0.12

Suki

Disable evaluation of templates (admin/ configuration/server settings), clean your error log, browser your forum or do whatever you did earlier and then check your error log again, post the new errors here.
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

iain sherriff

Its a test board if you want admin access ?


Apply Filter: Only show the error messages of this member Administrator
Apply Filter: Only show the error messages of this IP address 86.134.203.59 
  Reverse chronological order of list Today at 10:21:36 AM
Apply Filter: Only show the error messages of this session 234ca87d91decee30fd97207b1751620
Apply Filter: Only show the errors of this type Type of error: Undefined
Apply Filter: Only show the error messages of this URL
http://isthatagnu.com/smf/index.php?action=faq;sa=manage
Apply Filter: Only show the errors with the same message
8: Undefined index: active_button
Apply Filter: Only show the errors from this file
File: /home/uklows/public_html/isthatagnu.com/smf/Themes/New_Folder/index.template.php
Line: 441
Apply Filter: Only show the error messages of this member Administrator
Apply Filter: Only show the error messages of this IP address 86.134.203.59 
  Reverse chronological order of list Today at 10:21:27 AM
Apply Filter: Only show the error messages of this session 234ca87d91decee30fd97207b1751620
Apply Filter: Only show the errors of this type Type of error: Undefined
Apply Filter: Only show the error messages of this URL
http://isthatagnu.com/smf/index.php?action=faq;sa=add
Apply Filter: Only show the errors with the same message
8: Undefined index: active_button
Apply Filter: Only show the errors from this file
File: /home/uklows/public_html/isthatagnu.com/smf/Themes/New_Folder/index.template.php
Line: 441
Apply Filter: Only show the error messages of this member Administrator
Apply Filter: Only show the error messages of this IP address 86.134.203.59 
  Reverse chronological order of list Today at 10:21:24 AM
Apply Filter: Only show the error messages of this session 234ca87d91decee30fd97207b1751620
Apply Filter: Only show the errors of this type Type of error: Undefined
Apply Filter: Only show the error messages of this URL
http://isthatagnu.com/smf/index.php?action=faq
Apply Filter: Only show the errors with the same message
8: Undefined index: active_button
Apply Filter: Only show the errors from this file
File: /home/uklows/public_html/isthatagnu.com/smf/Themes/New_Folder/index.template.php
Line: 441
Apply Filter: Only show the error messages of this member Administrator
Apply Filter: Only show the error messages of this IP address 86.134.203.59 
  Reverse chronological order of list Today at 10:21:20 AM
Apply Filter: Only show the error messages of this session 234ca87d91decee30fd97207b1751620
Apply Filter: Only show the errors of this type Type of error: Undefined
Apply Filter: Only show the error messages of this URL
http://isthatagnu.com/smf/index.php?board=1.0
Apply Filter: Only show the errors with the same message
8: Undefined index: active_button
Apply Filter: Only show the errors from this file
File: /home/uklows/public_html/isthatagnu.com/smf/Themes/New_Folder/index.template.php
Line: 441
Apply Filter: Only show the error messages of this member Administrator
Apply Filter: Only show the error messages of this IP address 86.134.203.59 
  Reverse chronological order of list Today at 10:21:14 AM
Apply Filter: Only show the error messages of this session 234ca87d91decee30fd97207b1751620
Apply Filter: Only show the errors of this type Type of error: Undefined
Apply Filter: Only show the error messages of this URL
http://isthatagnu.com/smf/index.php?action=post;topic=1.0;last_msg=2
Apply Filter: Only show the errors with the same message
8: Undefined index: active_button
Apply Filter: Only show the errors from this file
File: /home/uklows/public_html/isthatagnu.com/smf/Themes/New_Folder/index.template.php
Line: 441
Apply Filter: Only show the error messages of this member Administrator
Apply Filter: Only show the error messages of this IP address 86.134.203.59 
  Reverse chronological order of list Today at 10:21:11 AM
Apply Filter: Only show the error messages of this session 234ca87d91decee30fd97207b1751620
Apply Filter: Only show the errors of this type Type of error: Undefined
Apply Filter: Only show the error messages of this URL
http://isthatagnu.com/smf/index.php?topic=1.0
Apply Filter: Only show the errors with the same message
8: Undefined index: active_button
Apply Filter: Only show the errors from this file
File: /home/uklows/public_html/isthatagnu.com/smf/Themes/New_Folder/index.template.php
Line: 441
Apply Filter: Only show the error messages of this member Administrator
Apply Filter: Only show the error messages of this IP address 86.134.203.59 
  Reverse chronological order of list Today at 10:21:09 AM
Apply Filter: Only show the error messages of this session 234ca87d91decee30fd97207b1751620
Apply Filter: Only show the errors of this type Type of error: Undefined
Apply Filter: Only show the error messages of this URL
http://isthatagnu.com/smf/index.php?board=1.0
Apply Filter: Only show the errors with the same message
8: Undefined index: active_button
Apply Filter: Only show the errors from this file
File: /home/uklows/public_html/isthatagnu.com/smf/Themes/New_Folder/index.template.php
Line: 441
Apply Filter: Only show the error messages of this member Administrator
Apply Filter: Only show the error messages of this IP address 86.134.203.59 
  Reverse chronological order of list Today at 10:21:06 AM
Apply Filter: Only show the error messages of this session 234ca87d91decee30fd97207b1751620
Apply Filter: Only show the errors of this type Type of error: Undefined
Apply Filter: Only show the error messages of this URL
http://isthatagnu.com/smf/index.php?
Apply Filter: Only show the errors with the same message
8: Undefined index: active_button
Apply Filter: Only show the errors from this file
File: /home/uklows/public_html/isthatagnu.com/smf/Themes/New_Folder/index.template.php
Line: 441
Apply Filter: Only show the error messages of this member Administrator
Apply Filter: Only show the error messages of this IP address 86.134.203.59 
  Reverse chronological order of list Today at 10:21:01 AM
Apply Filter: Only show the error messages of this session 234ca87d91decee30fd97207b1751620
Apply Filter: Only show the errors of this type Type of error: Undefined
Apply Filter: Only show the error messages of this URL
http://isthatagnu.com/smf/index.php?action=admin;area=logs;sa=errorlog;desc
Apply Filter: Only show the errors with the same message
8: Undefined index: active_button
Apply Filter: Only show the errors from this file
File: /home/uklows/public_html/isthatagnu.com/smf/Themes/New_Folder/index.template.php
Line: 441
SMF 2.0.12

Suki

did you change anything in index.template.php?

the Undefined index: active_button can be triggered by any button in the menu.
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

Advertisement: