OS Property support center

Add agent to specific User group

  • Apurv
  • Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
11 years 8 months ago #39724 by Apurv
Add agent to specific User group was created by Apurv
How to automatically add anyone registering to become an Agent in a specific User group ?

Please Log in or Create an account to join the conversation.

More
11 years 8 months ago #39725 by Dang Thuc Dam
Replied by Dang Thuc Dam on topic Re: Add agent to specific User group
Hi,
In that case, you must write the system plugin to check and add user from specific User group to agent list. The plugin should implement 2 tasks
1. Check users from Specific user groups to see whether if he is agent or not
2. If not, register him to become agent
Dam

Please Log in or Create an account to join the conversation.

  • Apurv
  • Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
11 years 8 months ago #39729 by Apurv
Replied by Apurv on topic Re: Add agent to specific User group
Can you help me in writing such a plugin ? or share me some links?

Please Log in or Create an account to join the conversation.

More
11 years 8 months ago #39730 by Dang Thuc Dam
Replied by Dang Thuc Dam on topic Re: Add agent to specific User group
Hi,
We haven't developed that kind of plugin. Your request isn't in original spec of component, so we can only suggest you the solution to implement it. If you want us to make the plugin for you, we should have the customization project. In that case, please submit ticket and we will let you know the estimate time and cost for the project.
Thank you and Happy New year
Dam

Please Log in or Create an account to join the conversation.

  • Apurv
  • Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
11 years 8 months ago #39731 by Apurv
Replied by Apurv on topic Re: Add agent to specific User group
Would it be possible to solve this by creating a DB trigger on the table where any entry is made when someone registers as an agent? The trigger SQL will add the newly added user to 'Agent' user group.

Please Log in or Create an account to join the conversation.

More
11 years 8 months ago #39751 by Dang Thuc Dam
Replied by Dang Thuc Dam on topic Re: Add agent to specific User group
Hi,
To add new agent, you can use this code
include_once(JPATH_ROOT."/administrator/components/com_osproperty/tables/agent.php");
$db = Jfactory::getDBO();
$user = Jfactory::getUser();
$agent = &JTable::getInstance('Agent','OspropertyTable');
$agent->id = 0;
$agent->user_id = $user->id;
$usergent = JFactory::getUser($row->user_id);
$agent->name = $user->name;
$agent->email = $user->email;
$db->setQuery("Select ordering from #__osrs_agents order by ordering desc");
$ordering = $db->loadResult();
$ordering++;
$agent->ordering = $ordering;
$agent->published = 1;
$agent->store();
$agent_id = $db->insertid();

This code is use to import current user (front-end) to agent database table. You can modify suit you need,
Good luck
Dam

Please Log in or Create an account to join the conversation.

  • Apurv
  • Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
11 years 8 months ago #39947 by Apurv
Replied by Apurv on topic Re: Add agent to specific User group
Where is the agent/owner registration code present ?

Please Log in or Create an account to join the conversation.

More
11 years 8 months ago #39950 by Dang Thuc Dam
Replied by Dang Thuc Dam on topic Re: Add agent to specific User group
Hi,
They are in these files: (version 2.6)
components > com_osproperty > classes > agent.php
components > com_osproperty > classes > agent.html.php
components > com_osproperty > helpers > layouts > agentregistration.php
Thanks
Dam

Please Log in or Create an account to join the conversation.

  • Apurv
  • Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
11 years 8 months ago #39952 by Apurv
Replied by Apurv on topic Re: Add agent to specific User group
In agent.php, there is SQL to insert agent info in to DB. Can I add a SQL just after this to insert the new agent to agent user group ? Will this work ?

Please Log in or Create an account to join the conversation.

More
11 years 8 months ago #39954 by Dang Thuc Dam
Replied by Dang Thuc Dam on topic Re: Add agent to specific User group
Please submit ticket and send your site information with super admin acc, user group ID. I will help you to make the system plugin to assign agent to the specific user group
Thanks
Dam

Please Log in or Create an account to join the conversation.

Moderators: Dang Thuc DamNguyen Phu Quan