Kayako logo
Developers & Code Interested in customizing your Kayako products? Discuss modifications and develop your own mods with the community.

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  (#1) Old
Dynadata Offline
Member
 
Posts: 171
Join Date: Feb 2008
Location: Netherlands
Extend registration page - 21-03-2008, 12:20 PM

Hi,

I want to extend my registration page by adding the choise of departments.
So I was thinking of the following:



But does anyone know how to get those departments into the register form?
It should be possible with a foreach statement....something like:

Code:
 
<{foreach key=key value=modification from=$departments}>
<input type="radio" name="<{$modification[title]}>"><{$modification[title]}> />
<{/foreach}>
Anyone can give me the correct code?
   
Reply With Quote
  (#2) Old
Dynadata Offline
Member
 
Posts: 171
Join Date: Feb 2008
Location: Netherlands
25-03-2008, 08:36 AM

I only need to know how to get the name of the departments from the table.
So what is the code to see the column 'title' from the table 'swdepartments'.
I need this piece of code in a foreach lus.

Any guys who know how to do this?
   
Reply With Quote
  (#3) Old
welch Offline
New Member
 
Posts: 29
Join Date: Oct 2007
Location: Lawrence
25-03-2008, 04:52 PM

Are you looking to hand code the query?

Without looking up the class for kayako query, i would just write a simple loop.

PHP Code:
$query mysql_query("SELECT departmentid, title FROM swdepartments ORDER BY displayorder");


while(
$results mysql_fetch_array($query)){
echo 
"<input type=\"radio\" name=\"department\" value=\"".$results['title']."\">".$results['title']."<br />";

   
Reply With Quote
  (#4) Old
Dewak Offline
Member
 
Dewak's Avatar
 
Posts: 139
Join Date: Feb 2008
25-03-2008, 05:42 PM

Hello,

If you are going to use the query posted by welch please add a WHERE sentence to include only ticket departments, otherwise your clients will submit tickets to LiveSupport department which makes no sense.

There's another solution but you will need to modify the client_submit.php file and pass the department name to the smarty template. Then in the template you just use that variable in the foreach statement that list the deparments.

Best


Andres Berdugo
Email & MSN: andres[at]dewak.com
Skype: andres.dewak
Dewak: Kayako Development, Consultancy and Support
http://www.dewak.com
   
Reply With Quote
  (#5) Old
Dynadata Offline
Member
 
Posts: 171
Join Date: Feb 2008
Location: Netherlands
25-03-2008, 07:20 PM

@Welch: Thank you for your input. I'm sure your code will be usefull to create this function.

@Dewak: In the first place I was planning to do this by your way but I was unable to do this.
I don't know how to pass the department name to the smarty template.
I could use the query welch said in the client_submit.php but how to pass on the variable to the smarty template?
   
Reply With Quote
  (#6) Old
Dynadata Offline
Member
 
Posts: 171
Join Date: Feb 2008
Location: Netherlands
26-03-2008, 09:48 AM

If I look by the Admin CP >> Templates I can edit the register form.
But where is that file located? I can't seem to find that file.

I found the file which contains the insert query (\includes\functions_users.php) with the function "insertUser"
Below you will see the query for it:
Code:
 
$dbCore->query("INSERT INTO `". TABLE_PREFIX ."users` (`usergroupid`, `fullname`, `userpassword`, `userpasswordtxt`, `dateline`, `lastvisit`, `lastactivity`, `enabled`, `loginapi_moduleid`, `loginapi_userid`, `languageid`, `timezoneoffset`, `enabledst`, `useremailcount`, `allowemail`, `ismanager`) VALUES ('". intval($usergroupid) ."', '". $dbCore->escape(iif(empty($fullname), $email, $fullname)) ."', '". iif($ismd5==true, $password, md5($password)) ."', '". $dbCore->escape($txtpassword) ."', '". DATENOW ."', '0', '0', '". iif($enabled==true, "1", "0") ."', '". intval($loginapi_moduleid) ."', '". $dbCore->escape($loginapi_userid) ."', '". intval($languageid) ."', '". $dbCore->escape($timezone) ."', '". iif($enabledst==true, "1", "0") ."', '1', '". intval($allowemail) ."', '". iif($ismanager==true, "1", "0") ."');");
The value for the usergroupid is "intval($usergroupid)".
Where will that variable be filled?

Last edited by Dynadata; 26-03-2008 at 10:03 AM.
   
Reply With Quote
  (#7) Old
Dynadata Offline
Member
 
Posts: 171
Join Date: Feb 2008
Location: Netherlands
26-03-2008, 12:59 PM

In my first post I descriped my intension on the wrong way.
I want clients that register by the client support interface, can choose which user group they want.
So I have now the following:



The numbers you see are the usergroupid's. This is the code I used:

Code:
 
$query = mysql_query("SELECT usergroupid, title FROM swusergroups WHERE grouptype = 'registered' ORDER BY title");
 
while ($results = mysql_fetch_array($query))
{
 echo "<input type=\"radio\" name=\"usergroupid\" value=\"".$results['usergroupid']."\"><span class=\"smalltext\">".$results['usergroupid']."</span><br />";
}
So your selection of the group can be accessed from $_POST['usergroupid'].
How to get that value into the table by clicking on register?
   
Reply With Quote
  (#8) Old
Matthew Offline
Member
 
Matthew's Avatar
 
Posts: 168
Join Date: Oct 2007
Location: Jakarta, Indonesia
26-03-2008, 03:51 PM

Quote:
Originally Posted by Dynadata View Post
In my first post I descriped my intension on the wrong way.
I want clients that register by the client support interface, can choose which user group they want.
I have so wanted this, and now I am watching these developments eagerly. Go man, go!


Matthew Arciniega
The Precision Group

+ Free: Ticket List & Ticket Search Mods

+ Free: (Almost) Perfect Outlook/HTML Tickets
+ Tutorials: SLA System Explained l Using Template Groups
Kayako v3.20.02 & v3.30.02 | PHP: 5.2.6 | MySQL: 5.0.58 | CentOS 4 Server
   
Reply With Quote
  (#9) Old
Dynadata Offline
Member
 
Posts: 171
Join Date: Feb 2008
Location: Netherlands
26-03-2008, 04:01 PM

The problem at this moment, is inserting the $_POST['usergroupid'] value into the table. So any help would greatly be appriciated.

EDIT:
The input fields that need to be inserted into the table users are:
- fullname
- email
- password
- passwordagain

I've added one field which name is:
- usergroupid

In "\includes\functions_users.php" you'll find "function renderUserForm($type)".
Inside this function you'll find
- $_POST["fullname"]
- $_POST["email"]
- $_POST["password"]
- $_POST["passwordconfirm"]


I've added after this line:
Code:
printTextRow("passwordconfirm", $_SWIFT["language"]["usrpasswordconfirm"], $_SWIFT["language"]["desc_usrpasswordconfirm"], "password", $_POST["passwordconfirm"]); 
The following:
Code:
printTextRow("usergroupid", $_SWIFT["language"]["usrformgroup"], $_SWIFT["language"]["desc_usrformgroup"], "text", $_POST["usergroupid"]); 
Still nothing changed after I placed that line in the function.
So where should I look to fill the variable "$usergroupid" which is used in the "insertUser" function?

Last edited by Dynadata; 28-03-2008 at 02:25 PM.
   
Reply With Quote
Reply

Tags
extend, registration

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
New Pay Per Ticket Module progress report jc11 Marketplace 12 03-04-2008 02:07 PM
How di I enable the registration page MaRiOsGR How do I? 7 30-01-2008 09:29 AM
Country list on registration page or any other populated list Ghazanchyan How do I? 5 19-12-2007 10:49 AM
How to disable Registration Required e-mail rolandw E-mail Piping Issues 1 29-10-2007 10:12 AM



Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vBulletin Skin developed by: vBStyles.com


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46