vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4.x Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=245)
-   -   New Posting Features - Easy Forms v4.x - Create a form or multiple forms without php or html knowledge (https://vborg.vbsupport.ru/showthread.php?t=234385)

Dragonsys 08-09-2010 06:30 PM

Quote:

Originally Posted by bada_bing (Post 2079778)
I am wondering I I setup a forum using Easy Forms if there is any way to intergrate this into vbadvanced?

what are you wanting for integration?

bananalive 08-09-2010 07:35 PM

Quote:

Originally Posted by Sarcoth (Post 2081403)
I tried the following with no luck for the top part. I think this is mostly correct, but I must be doing a variable the wrong way.

PHP Code:

    $shuserid $vbulletin->db->query_first("select userid from vBull_user where username='{$qo['shuser']}'");
    
$userinfo=fetch_userinfo($qo[$shuserid]); 


PHP Code:



$shuserid 
$vbulletin->db->query_first("
 SELECT userid
 FROM "
TABLE_PREFIX ."user
 WHERE username = '" 
$db->escape_string($qo['shuser']) . "'
"
); 


Willy T 08-10-2010 11:23 PM

Can you please make

Quote:

Usergroups Allowed to Edit Forms
Usergroups allowed to add/edit/delete forms (Permission to view Form List is recommended for these usergroups)
each on their own line? I want usergroups to be able to CREATE forms but not delete everyone's in the event someone get's angry. They can request deletion by a moderator.

Thank you!

Sarcoth 08-11-2010 12:04 AM

Quote:

Originally Posted by bananalive (Post 2081459)
PHP Code:

$shuserid $vbulletin->db->query_first("
 SELECT userid
 FROM "
TABLE_PREFIX ."user
 WHERE username = '" 
$db->escape_string($qo['shuser']) . "'
"
); 


Good stuff Banana, thank you. I got it working! :) I am using a custom question which selects a user from usergroup 2; reference name = shuser.
PHP Code:

$answer .= '<select name="'.$formbit[id].'">';
$members $db->query_read("SELECT * FROM " TABLE_PREFIX "user
WHERE usergroupid = 2
ORDER BY username ASC"
);
    while(
$row $db->fetch_array($members)) {
$answer .= '<option value="'.$row[username].'"';
if (
$row[username] == $thisanswer) {
$answer .= 'selected="selected"';
}
$answer .= '>'.$row[username].'</option>';
}
$answer .= '</select>'


Then, here is the code I am using to move a user to a new usergroup:
PHP Code:

$shuserid $vbulletin->db->query_first("
    SELECT userid
    FROM "
TABLE_PREFIX ."user
    WHERE username = '" 
$db->escape_string($qo['shuser']) . "'
"
);
//print_r($shuserid['userid']);

if ($complete) {
    
$userinfo=fetch_userinfo($shuserid[userid]);
    
    
//**Replace 18 with choosen usergroupid you want to add them to**//
    
$user['usergroupid'] = 18;

    if (empty(
$user['usergroupid'])) {
        
$user['usergroupid'] = 2;
    }

    
$getusergroupid iif($userinfo['displaygroupid'] != $userinfo['usergroupid'], $userinfo['displaygroupid'], $user['usergroupid']);

    
$user_usergroup =& $vbulletin->usergroupcache["$user[usergroupid]"];
    
$display_usergroup =& $vbulletin->usergroupcache["$getusergroupid"];

    
$userdata =& datamanager_init('User'$vbulletinERRTYPE_STANDARD);
    
$userdata->set_existing($userinfo);
    
$userdata->set('usergroupid'$user['usergroupid']);
    
$userdata->set_usertitle(
        
$user['customtitle'] ? $user['usertitle'] : '',
        
false,
        
$display_usergroup,
        (
$user_usergroup['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['canusecustomtitle']) ? true false,
        (
$user_usergroup['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['cancontrolpanel']) ? true false
    
);

    require_once(
DIR '/includes/functions_ranks.php');
    if (
$user['userid'] == $vbulletin->userinfo['userid']) {
        
$vbulletin->userinfo['usergroupid'] = $user['usergroupid'];
        
$vbulletin->userinfo['displaygroupid'] = $user['usergroupid'];
    }

    
$userdata->save();



bigrover 08-11-2010 07:01 PM

Thank you, bananalive. This is a great mod. :up:

Is there an obvious location where the form id is displayed? I am interested so I can manage the redirect location for my newthread_form_complete plugin.

I also would like to see some method of autocomplete of a field through comparison to a database field such as username. Sounds like some AJAX and Javascripting would be involved, not unlike what is happening during a vB user registration when it is checking the length and content of the new username while it is being entered.

mokonzi 08-11-2010 07:32 PM

The form ID is always included in the URL...

bigrover 08-12-2010 04:42 AM

How can I adjust the forum destination for the form results dynamically? Specifically, I want to recognize the forum I am in when I make the call to the form 'http://www.your-site.com/forum/misc.php?do=form&fid=1'. I am using the plugin example below and adjusted the array to the custom forum. It correctly loaded the form rather than the standard post editor, but it saved the results into the destination forum coded in the form (forum #2), and not the current forum where it was launched. Can I override that behavior?

Create vBulletin Plugin with hook location newthread_form_complete
PHP Code:
if (in_array($forumid, array(3)))
{
header( 'Location: http://www.your-site.com/forum/misc.php?do=form&fid=1' ) ;
}
Originally Posted by StagKill View Post

bigrover 08-12-2010 12:56 PM

I am getting the following error from the Form Hook: Before Submit:

Unable to add cookies, header already sent.
File: /home/yoursite.org/public_html/forums/misc.php(89) : eval()'d code(491) : eval()'d code
Line: 1

The code I entered is:

$form[forumid] = forumid

I am trying to get the form to go to the current forum where the user clicked on the link to go to the form. What am I doing wrong?

***

On a separate thought, does the misc.php accept an argument containing the forumid, like the newthread.php? I could pass the forumid at the time the form is called if it does.

AliceHoward 08-13-2010 04:39 PM

In a word, perfect, thank you. :)

Choez 08-14-2010 02:01 PM

Still looking for a tip/hint as to how I can make a form submit twice to 2 different locations :) Been playing around with it myself but I can't get it to work :-/

redraider 08-15-2010 10:25 PM

Need help, I havent been able to figure out how to allow user to choose which forum they want to post the question to.

In short : There is just one form that the user uses, and in that form, he chooses from a drop down which forum he should post the question to.

How would I be able to achieve this.

Any help will be great!

bananalive 08-16-2010 03:46 PM

Quote:

Originally Posted by redraider (Post 2084503)
Need help, I havent been able to figure out how to allow user to choose which forum they want to post the question to.

In short : There is just one form that the user uses, and in that form, he chooses from a drop down which forum he should post the question to.

How would I be able to achieve this.

Any help will be great!

  1. Create Custom Question with:
    Reference Name: forumid
    PHP Code:
    PHP Code:

    $answer "<select name=\"$formbit[id]\" id=\"q_" $formbit[id]  ."\">";

    foreach (
    $vbulletin->forumcache AS $forumid  => $forum)
    {
    if (
    $qo['forumid']==$forumid)
    {
    $forum['selected'] = ' selected="selected"';
    }
    $answer .= "<option value=\"$forumid\"$forum[selected]>$forum[title]</option>";
    }
    $answer .= "</select>"

  2. Edit Form -> Form Hook: Before Submit:
    PHP Code:

    $forumid $form['forumid'] = $qo['forumid']; 


bananalive 08-16-2010 03:47 PM

Quote:

Originally Posted by bigrover (Post 2082661)
I am getting the following error from the Form Hook: Before Submit:

Unable to add cookies, header already sent.
File: /home/thebonvi/domains/thebonvivant.org/public_html/forums/misc.php(89) : eval()'d code(491) : eval()'d code
Line: 1

The code I entered is:

$form[forumid] = forumid

I am trying to get the form to go to the current forum where the user clicked on the link to go to the form. What am I doing wrong?

***

On a separate thought, does the misc.php accept an argument containing the forumid, like the newthread.php? I could pass the forumid at the time the form is called if it does.

You are using invalid php in one of the hooks.

The following is an example of correct php:

PHP Code:

$form['forumid'] = '3'


Bigj85 08-16-2010 11:41 PM

hey banana,been using easyforms a while and love it

just lately though I tried using the question variables for the form output

the form output should be {q_1} Review for {q_2} by {username}

{q_1} being a game name and {q_2} being the platform,so the output should read something like

"mass effect 2 review for PC by bigj85"

but only the username variable is working so I get

"Review for by bigj85"

am I doing something wrong here?

I'm having the forms output sent to a forum as their own thread btw

Welshy2008 08-17-2010 11:29 AM

Is this great mod been confirmed as working on an upgrade from 4.0.5 and 4.0.6, Please?

Sarcoth 08-17-2010 01:17 PM

Quote:

Originally Posted by Bigj85 (Post 2085001)
hey banana,been using easyforms a while and love it
just lately though I tried using the question variables for the form output
the form output should be {q_1} Review for {q_2} by {username}
{q_1} being a game name and {q_2} being the platform,so the output should read something like
"mass effect 2 review for PC by bigj85"
but only the username variable is working so I get
"Review for by bigj85"
am I doing something wrong here?
I'm having the forms output sent to a forum as their own thread btw

{q_#} does not mean the first question. It represents the questions number. Go to the edit form page for the form you are looking at. Go to the bottom. You'll see your questions listed like so:

Quote:

1. What is the name of the game? (Single Line Text Field) #38
The number at the end there (#38) is the question's number. So, that would be {q_38}.

Personally, I recommend using reference name within the question (like gamename) and then doing {q_gamename} instead, but that's up to you.

temporaryins 08-17-2010 05:51 PM

Quote:

Originally Posted by Welshy2008 (Post 2085203)
Is this great mod been confirmed as working on an upgrade from 4.0.5 and 4.0.6, Please?

I've had it running on 4.0.5, upgrade to 4.0.6, still working fine.

Bigj85 08-17-2010 09:00 PM

Quote:

Originally Posted by Sarcoth (Post 2085255)
{q_#} does not mean the first question. It represents the questions number. Go to the edit form page for the form you are looking at. Go to the bottom. You'll see your questions listed like so:



The number at the end there (#38) is the question's number. So, that would be {q_38}.

Personally, I recommend using reference name within the question (like gamename) and then doing {q_gamename} instead, but that's up to you.


ahhhh thanks Sarcoth that did the trick :)

bigrover 08-18-2010 05:06 AM

I am unable to affect the destination of the form results with the code you corrected below in the form hook before submit location. The form always goes to the destination specified in the "Forumid where Thread is posted:" location. In my case I have a main category (forum 1), a main forum (forum 2) and a review forum (forum 3). I even tried setting "Forumid where Thread is posted:" to the main category. I didn't get an error, but the form results did not appear in either forum. Not sure where it went. I'm not getting an error message anymore, but neither am I able to redirect the form output.

Per your comments in post #651 I also tried the forum assignment without the single quotes surrounding the target forum with no change in behavior.

PHP Code:

$form['forumid'] = 3

Quote:

Originally Posted by bananalive (Post 2084811)
You are using invalid php in one of the hooks.

The following is an example of correct php:

PHP Code:

$form['forumid'] = '3'



bananalive 08-18-2010 09:38 AM

Quote:

Originally Posted by bigrover (Post 2085620)
I am unable to affect the destination of the form results with the code you corrected below in the form hook before submit location. The form always goes to the destination specified in the "Forumid where Thread is posted:" location. In my case I have a main category (forum 1), a main forum (forum 2) and a review forum (forum 3). I even tried setting "Forumid where Thread is posted:" to the main category. I didn't get an error, but the form results did not appear in either forum. Not sure where it went. I'm not getting an error message anymore, but neither am I able to redirect the form output.

Per your comments in post #651 I also tried the forum assignment without the single quotes surrounding the target forum with no change in behavior.

PHP Code:

$form['forumid'] = 3


To affect the destination forum you need both variables changing, as below:

PHP Code:

$forumid $form['forumid'] = 3


bigrover 08-18-2010 08:46 PM

OK, that did get the message into forum #3, but the posting updated the forum statistics on the forums display page for both forum #2 and forum #3, including the title of the post, the user and the posting date & time stamp. Forum #2 now shows 11 threads but when you open it there are only 10. Forum #2 is the forum specified as the destination in the form itself, and it is being over-ridden to send the form to #3.

If you would like to hack around on my box to see what is going on, send me a PM.

riskofficer 08-19-2010 08:53 AM

Hello!

My database already contains 300 inputs with 10 columns each. Speed of generating new exports decreased dramticaly, but im planning that database will be thousends of inputs for next few years. Is there any solves of such problem? May be prepare export file not on demand but by schedule?

bananalive 08-19-2010 10:16 AM

Quote:

Originally Posted by bigrover (Post 2085988)
OK, that did get the message into forum #3, but the posting updated the forum statistics on the forums display page for both forum #2 and forum #3, including the title of the post, the user and the posting date & time stamp. Forum #2 now shows 11 threads but when you open it there are only 10. Forum #2 is the forum specified as the destination in the form itself, and it is being over-ridden to send the form to #3.

If you would like to hack around on my box to see what is going on, send me a PM.

Try this:
PHP Code:

$form['forumid'] = 3;  
if (
$forumid $form['forumid'])
{
    
$foruminfo verify_id('forum'$forumid01);
    
$forumperms fetch_permissions($forumid);


$foruminfo is used later in the script to rebuild thread counters.

bananalive 08-19-2010 10:19 AM

Quote:

Originally Posted by riskofficer (Post 2086203)
Hello!

My database already contains 300 inputs with 10 columns each. Speed of generating new exports decreased dramticaly, but im planning that database will be thousends of inputs for next few years. Is there any solves of such problem? May be prepare export file not on demand but by schedule?

Are your inputs containing bb code which needs to be parsed?

If they are not, then you could stop the bbcode parsing, which should speed up process.

riskofficer 08-19-2010 10:35 AM

Quote:

Originally Posted by bananalive (Post 2086227)
Are your inputs containing bb code which needs to be parsed?

If they are not, then you could stop the bbcode parsing, which should speed up process.

Hmm, how can I stop bbcode parsing for easyforms?

The problem is, even "Form Results" where I can edit database, generating too long, and each new entry making this time longer. May be split on pages "Form Results" and @From Results table".

But "Form results Poll" and "Export to Excel" will still generating too long and hang up server.

May be option "ondemand-real-time/schedule" is better?

Willy T 08-20-2010 12:45 AM

Hey Bananalive- this is about my 3-4th request without a single reply so I guess I need to keep trying.

Can you please assist with making

Quote:

Usergroups Allowed to Edit Forms
Usergroups allowed to add/edit/delete forms (Permission to view Form List is recommended for these usergroups)
each on their own line? I want usergroups to be able to CREATE forms but not delete everyone's in the event someone get's angry. They can request deletion by a moderator.

Greatly appreciate the help.

joeman 08-20-2010 05:14 PM

Hey banana I tried adding this to my 4.0.6 and it seems like a great plugin but when I try to click on it from a tab from an addition tab plugin, I get an error code that says:

(Message)
"Error, this form does not exist."

Do you have any idea why it says I'm getting an error that the form I made doesn't exist or have you seen that problem before?

Thanks

bchertov 08-24-2010 02:14 AM

This looks like a great idea, but I've got no idea how this works!
Is there a help file or tutorial or fully explained example someplace?

bigrover 08-24-2010 03:34 AM

The code you posted below worked. Now I need to figure out how to store the current forum when the form is called, then apply it in this script. I'm going to do some looking for a variable that may contain this information, then figure out how to store it and retrieve it when needed. If anyone has any suggestions I would greatly appreciate it.

I do have to say I really like this script, particularly the ability to format the output as desired with conditional statements based on the form data. It works great. Thanks Bananalive, good work.

Bchertov, I managed to figure this out mainly by reading through all the pages of this thread, then installing it on a development site and just hacking out a form and watching what happened.

Quote:

Originally Posted by bananalive (Post 2086225)
Try this:
PHP Code:

$form['forumid'] = 3;  
if (
$forumid $form['forumid'])
{
    
$foruminfo verify_id('forum'$forumid01);
    
$forumperms fetch_permissions($forumid);


$foruminfo is used later in the script to rebuild thread counters.


laric 08-24-2010 11:23 AM

Quote:

Originally Posted by laric (Post 2075189)
I love this mod.
I have a weird usage for it perhaps.

I am using it for guild applications for our gaming guild.

Thus I need the full form posted to the officers forum. (Works just fine)

Then I need a subset of the form posted to the 'highend' members forum.

How would I go about to do that?

I am somewhat familiar with php but not very familiar with the vb structure of the code.

I guess I need a hook/plugin somewhere?

Bananalive. Any chance that you could help me with this one. This is the last part I need before I can move from my old SMF forum over to my new VB forum.

Sarcoth 08-24-2010 11:26 AM

@ Laric - I've seen the answer to this on another page. I even provided a link to it on this page (15).

Stryker412 08-24-2010 05:12 PM

I have a small issue, I was able to export my form from my vb3 install to our new vb4 install. Everything works great except there's an issue with the drop down questions. The box with the options are very narrow and the full text cannot be seen.

reesev 08-24-2010 10:37 PM

Quote:

Originally Posted by bananalive (Post 2084808)
  1. Create Custom Question with:
    Reference Name: forumid
    PHP Code:
    PHP Code:

    $answer "<select name=\"$formbit[id]\" id=\"q_" $formbit[id]  ."\">";

    foreach (
    $vbulletin->forumcache AS $forumid  => $forum)
    {
    if (
    $qo['forumid']==$forumid)
    {
    $forum['selected'] = ' selected="selected"';
    }
    $answer .= "<option value=\"$forumid\"$forum[selected]>$forum[title]</option>";
    }
    $answer .= "</select>"

  2. Edit Form -> Form Hook: Before Submit:
    PHP Code:

    $forumid $form['forumid'] = $qo['forumid']; 


This worked great is there a easy way to make it only show certain forums instead of listing them all?

thanks in advance

laric 08-25-2010 09:02 AM

Quote:

Originally Posted by Sarcoth (Post 2088787)
@ Laric - I've seen the answer to this on another page. I even provided a link to it on this page (15).

Thanks for that one. The problem is that I don't want all of the form posted on the second post. I want a subset of the questions/answers in the second post.

stationar 08-28-2010 03:19 AM

For some reason all form results are gone. I get: Error, this form does not have any results stored in the database.
I checked in the database, and yes, the "formresults" table is empty.
I checked moderators log for product "Easy Forms", and it didn't contain any data. So, moderators actions don't get logged?

temporaryins 08-29-2010 05:39 AM

Might be considered a weird question but...

Is there any way to implement a "time it took to complete" function for a form, that would then be shown at some point on the submission?

bananalive 08-29-2010 07:59 PM

Quote:

Originally Posted by stationar (Post 2090594)
For some reason all form results are gone. I get: Error, this form does not have any results stored in the database.
I checked in the database, and yes, the "formresults" table is empty.
I checked moderators log for product "Easy Forms", and it didn't contain any data. So, moderators actions don't get logged?

Weird... there is not a button to delete all of them, so they must have deleted all of them individually.

No, Easy Forms does not create any logs.

bananalive 08-29-2010 08:02 PM

Quote:

Originally Posted by reesev (Post 2089085)
This worked great is there a easy way to make it only show certain forums instead of listing them all?

thanks in advance

Change 1,2,3 with appropriate forumids in below example:
Quote:

Originally Posted by bananalive (Post 2084808)
  1. Create Custom Question with:
    Reference Name: forumid
    PHP Code:
    PHP Code:

    $answer "<select name=\"$formbit[id]\" id=\"q_" $formbit[id]  ."\">";

    foreach (
    $vbulletin->forumcache AS $forumid  => $forum)
    {
    if (!
    in_array($forumid, array(1,2,3)))
    {
    continue;
    }
    if (
    $qo['forumid']==$forumid)
    {
    $forum['selected'] = ' selected="selected"';
    }
    $answer .= "<option value=\"$forumid\"$forum[selected]>$forum[title]</option>";
    }
    $answer .= "</select>"

  2. Edit Form -> Form Hook: Before Submit:
    PHP Code:

    $forumid $form['forumid'] = $qo['forumid']; 



bananalive 08-29-2010 08:05 PM

Quote:

Originally Posted by Stryker412 (Post 2088948)
I have a small issue, I was able to export my form from my vb3 install to our new vb4 install. Everything works great except there's an issue with the drop down questions. The box with the options are very narrow and the full text cannot be seen.

As of v4.1.7 you can change width of dropdown <select>s.

Edit: just realised i have not released v4.1.7 yet... so I will now.

ascroft 08-30-2010 08:24 AM

Hi - this is neat. Thanks. Can I use the same form across multiple forums? Or do I have to copy in to each forum. I was hoping a user could select from a predefined list??


All times are GMT. The time now is 04:14 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03141 seconds
  • Memory Usage 1,935KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (18)bbcode_php_printable
  • (24)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (2)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete