- Posts: 106
- Thank you received: 1
OS Property support center
How to check if user filled in agent profile?
- kalesh.suby
- Topic Author
- Offline
- Premium Member
-
Less
More
11 years 8 months ago #39785
by kalesh.suby
How to check if user filled in agent profile? was created by kalesh.suby
Hi Dam.
How to check if a logged in user has filled in Agent profile? Please see the module that I have written below - Its not working - Please help.
Thanks
How to check if a logged in user has filled in Agent profile? Please see the module that I have written below - Its not working - Please help.
Code:
<?php // no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
JTable::addIncludePath(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_osproperty'.DS.'tables');
$table = JTable::getInstance('agent', 'Table');
$user = JFactory::getUser();
if ($user->id && $table->load($user->id)) {
echo "User has filled OS property Agent profile";
}
else {
echo "User has not filled OS property Agent profile";
}
?>
Thanks
Please Log in or Create an account to join the conversation.
- kalesh.suby
- Topic Author
- Offline
- Premium Member
-
Less
More
- Posts: 106
- Thank you received: 1
11 years 8 months ago - 11 years 8 months ago #39831
by kalesh.suby
Replied by kalesh.suby on topic Re: How to check if user filled in agent profile?
Hi Dam,
There is a very important reason I asked this.
If a user clicks on joomla registration and becomes a member, as soon as he logs in he will try to add a property. When he clicks on "Add Property" OS property simply says ="You dont have permission to go to this area". This does not tell the logged in user WHY. They will simply get out of the site thinking they are not allowed to add property even after joomla registration and login.
You have used the same language constant "You dont have permission to go to this area" for many places so I cannot even override this - It will show the new text everywhere.
This is why I created that module which I can use to display a custom text that "Hey user, you are logged in but to add a property, you need to complete your Agent/Owner profile".
Please think like a site visitor - If you login to a site you want to register and get started. A message such as "You dont have permission" will only confuse users.
Also when a joomla user tries to add a property, he should be RE-DIRECTED to the agent profile completion page.
Thanks
There is a very important reason I asked this.
If a user clicks on joomla registration and becomes a member, as soon as he logs in he will try to add a property. When he clicks on "Add Property" OS property simply says ="You dont have permission to go to this area". This does not tell the logged in user WHY. They will simply get out of the site thinking they are not allowed to add property even after joomla registration and login.
You have used the same language constant "You dont have permission to go to this area" for many places so I cannot even override this - It will show the new text everywhere.
This is why I created that module which I can use to display a custom text that "Hey user, you are logged in but to add a property, you need to complete your Agent/Owner profile".
Please think like a site visitor - If you login to a site you want to register and get started. A message such as "You dont have permission" will only confuse users.
Also when a joomla user tries to add a property, he should be RE-DIRECTED to the agent profile completion page.
Thanks
Last edit: 11 years 8 months ago by kalesh.suby.
Please Log in or Create an account to join the conversation.
- Dang Thuc Dam
-
- Offline
- Administrator
-
Less
More
- Posts: 13244
- Thank you received: 1729
11 years 8 months ago #39832
by Dang Thuc Dam
Replied by Dang Thuc Dam on topic Re: How to check if user filled in agent profile?
Hi Kalesh,
You are correct, i already have the idea to implement the Error layout for all cases (agents, companies, permission .etc), i will implmenent it for version 2.6.1
Thanks
Dam
You are correct, i already have the idea to implement the Error layout for all cases (agents, companies, permission .etc), i will implmenent it for version 2.6.1
Thanks
Dam
Please Log in or Create an account to join the conversation.
- kalesh.suby
- Topic Author
- Offline
- Premium Member
-
Less
More
- Posts: 106
- Thank you received: 1
11 years 8 months ago #39833
by kalesh.suby
Replied by kalesh.suby on topic Re: How to check if user filled in agent profile?
Thanks Dam.
It will still be helpful to get the php code to check if user has filled in Agent profile. This way we can display custom modules prompting users to complete profile. Can you please see the code below and I think it would be just a few lines of code to check if a user has entries in osrs_agent table. If its easy please suggest the code if not, please give some hints and I will try myself.
It will still be helpful to get the php code to check if user has filled in Agent profile. This way we can display custom modules prompting users to complete profile. Can you please see the code below and I think it would be just a few lines of code to check if a user has entries in osrs_agent table. If its easy please suggest the code if not, please give some hints and I will try myself.
Code:
<?php // no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
JTable::addIncludePath(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_osproperty'.DS.'tables');
$table = JTable::getInstance('agent', 'Table');
$user = JFactory::getUser();
if ($user->id && $table->load($user->id)) {
echo "User has filled OS property Agent profile";
}
else {
echo "User has not filled OS property Agent profile";
}
?>
Please Log in or Create an account to join the conversation.
- Dang Thuc Dam
-
- Offline
- Administrator
-
Less
More
- Posts: 13244
- Thank you received: 1729
11 years 8 months ago #39850
by Dang Thuc Dam
Replied by Dang Thuc Dam on topic Re: How to check if user filled in agent profile?
Hi,
It means you want to have the code to update registered user to become Owner or Agent automatically?
Thanks
Dam
It means you want to have the code to update registered user to become Owner or Agent automatically?
Thanks
Dam
Please Log in or Create an account to join the conversation.
- kalesh.suby
- Topic Author
- Offline
- Premium Member
-
Less
More
- Posts: 106
- Thank you received: 1
11 years 8 months ago #39853
by kalesh.suby
No Sir - Its not a good idea to do that - I just was looking for the few lines of code to check if a joomla user has filled in Agent profile or not.
In my example code I was thinking
will do the trick of checking if joomla user has filled in profile but it does not work.
Once I have the php code to check if the user has filled in Agent profile or not, I will use my custom module to display a nice module with some text saying - "Please complete your Agent profile before you can add property". I can share my module mod_Ospropertyprofilecomplete to you as an addition to osproperty if you want
Thanks
Replied by kalesh.suby on topic Re: How to check if user filled in agent profile?
It means you want to have the code to update registered user to become Owner or Agent automatically?
No Sir - Its not a good idea to do that - I just was looking for the few lines of code to check if a joomla user has filled in Agent profile or not.
In my example code I was thinking
Code:
if ($user->id && $table->load($user->id)) {
Once I have the php code to check if the user has filled in Agent profile or not, I will use my custom module to display a nice module with some text saying - "Please complete your Agent profile before you can add property". I can share my module mod_Ospropertyprofilecomplete to you as an addition to osproperty if you want

Thanks
Please Log in or Create an account to join the conversation.
- kalesh.suby
- Topic Author
- Offline
- Premium Member
-
Less
More
- Posts: 106
- Thank you received: 1
11 years 8 months ago #39855
by kalesh.suby
Replied by kalesh.suby on topic Re: How to check if user filled in agent profile?
Hi Dam,
I have figured out the code to check if user has filled in Agent profile. Its only 5 or 6 lines of code.
Thanks
I have figured out the code to check if user has filled in Agent profile. Its only 5 or 6 lines of code.
Thanks
Please Log in or Create an account to join the conversation.
- kalesh.suby
- Topic Author
- Offline
- Premium Member
-
Less
More
- Posts: 106
- Thank you received: 1
11 years 8 months ago - 11 years 8 months ago #39857
by kalesh.suby
Replied by kalesh.suby on topic Re: How to check if user filled in agent profile?
I have completed the module's version 1. I have linked a image of how the module looks like. I have coded a profile completeness meter based on the fields I use and it also prompts the username
img802.imageshack.us/img802/3475/syxb.jpg
img802.imageshack.us/img802/3475/syxb.jpg
Last edit: 11 years 8 months ago by kalesh.suby.
Please Log in or Create an account to join the conversation.
- Dang Thuc Dam
-
- Offline
- Administrator
-
Less
More
- Posts: 13244
- Thank you received: 1729
11 years 8 months ago #39860
by Dang Thuc Dam
Replied by Dang Thuc Dam on topic Re: How to check if user filled in agent profile?
OK, good
Dam
Dam
Please Log in or Create an account to join the conversation.
- kalesh.suby
- Topic Author
- Offline
- Premium Member
-
Less
More
- Posts: 106
- Thank you received: 1
11 years 8 months ago #39873
by kalesh.suby
Replied by kalesh.suby on topic Re: How to check if user filled in agent profile?
Hi Dam - I forgot about 2nd part that I asked.
When a joomla user tries to add a property, he should be RE-DIRECTED to the agent profile completion page.
Are you planning to implement this in version 2.6.1 instead of just saying "You dont have permission"?
Thanks
When a joomla user tries to add a property, he should be RE-DIRECTED to the agent profile completion page.
Are you planning to implement this in version 2.6.1 instead of just saying "You dont have permission"?
Thanks
Please Log in or Create an account to join the conversation.
Moderators: Dang Thuc Dam, Nguyen Phu Quan
Support
Documentation
Information
Copyright © 2025 Joomla Extensions by Joomdonation. All Rights Reserved.
joomdonation.com is not affiliated with or endorsed by the Joomla! Project or Open Source Matters.
The Joomla! name and logo is used under a limited license granted by Open Source Matters the trademark holder in the United States and other countries.
The Joomla! name and logo is used under a limited license granted by Open Source Matters the trademark holder in the United States and other countries.