Users and Sessions
Permalink
Hey all,
i created two new coluns in "users" table of concrete5 and those are:
Name: that refers to the complete name of the user
Job: that refers to the post of the user in the company.
the thing is, when the user log in i want to get is name and job to a input text in another page.
btw after my website goes online the first page will have to be the login form so the users can´t see any content of the site. how do i do that?
i created two new coluns in "users" table of concrete5 and those are:
Name: that refers to the complete name of the user
Job: that refers to the post of the user in the company.
the thing is, when the user log in i want to get is name and job to a input text in another page.
btw after my website goes online the first page will have to be the login form so the users can´t see any content of the site. how do i do that?
any1?
Assuming the "columns" that you mention are user attributes, you could do this
And the same for the "Job" attribute..
To force the login page you would just deny "Guest" viewing permissions on your home page..
<?php $u = new User(); if($u->isLoggedIn()) { $ui = UserInfo::getByID($u->getUserID()); echo $ui->getAttribute('Name'); } ?>
And the same for the "Job" attribute..
To force the login page you would just deny "Guest" viewing permissions on your home page..
so the user will login and then it that page that code will get the name and job of current user? i forget to say that this code will be in a external page and it will put in the site trought the iframe. will it work anyway?
and how do i set the coluns to user atributes?
thanks for the reply ;)
and how do i set the coluns to user atributes?
thanks for the reply ;)
Type 'attributes' in the Intelligent Search box and choose 'Attributes' under 'Members'.
This is the way to add columns to the 'UserSearchIndexAttributes' table. If you add a 'Text' attribute called 'Name', then weyboat's example will grab that value for the logged in user. I would recommend adding 'first_name' and 'last_name' as attributes rather than just 'name'. If you set these attributes to 'Required' then any past members who haven't yet entered this info will be asked for it the next time they log in.
Manually adding columns to tables is dangerous because all the built-in concrete5 functions (and there are lots of them) will not know anything about your new columns and you will have to write all the code yourself to access these columns.
This is the way to add columns to the 'UserSearchIndexAttributes' table. If you add a 'Text' attribute called 'Name', then weyboat's example will grab that value for the logged in user. I would recommend adding 'first_name' and 'last_name' as attributes rather than just 'name'. If you set these attributes to 'Required' then any past members who haven't yet entered this info will be asked for it the next time they log in.
Manually adding columns to tables is dangerous because all the built-in concrete5 functions (and there are lots of them) will not know anything about your new columns and you will have to write all the code yourself to access these columns.
so i add the attributes in the members section and put the code on my external page and this is what i get
Fatal error: Class 'User' not found in D:\Xampp\htdocs\concrete\themes\destyle\Participacao.php on line 175
Fatal error: Class 'User' not found in D:\Xampp\htdocs\concrete\themes\destyle\Participacao.php on line 175
The code above works fine on my site. Perhaps you can post the external php file here. (Remove any private info first and change the extension to .txt to post it to the forum)
the file is attached, its located in the theme folder. its that correct??
and the the name and job should appear in a locked text area, the code works fine with the addon simple php code. but in my external i got the fatal error. and as i sayed i need to pull the name and job in a text area
and the the name and job should appear in a locked text area, the code works fine with the addon simple php code. but in my external i got the fatal error. and as i sayed i need to pull the name and job in a text area
I think you want to implement this as an 'External Form'. You can read about it here:
http://www.concrete5.org/community/forums/chat/external_forms_file_...
Also, I don't see weyboat's example code shown above anywhere in that file.
http://www.concrete5.org/community/forums/chat/external_forms_file_...
Also, I don't see weyboat's example code shown above anywhere in that file.
its because the Fatal error: Class 'User' not found. i removed the code to test something
so i got it everything working now trought a external form. thx for the help until here ;) now i have another problem. my font style is changing to default when i use external forms... but not in the other pages...
I assume you mean that the styles on your external form are changing the styles on the rest of the site?
If so, wrap the form in a div with a class:
and add this new class in front of your existing css classes on your external form like this:
If so, wrap the form in a div with a class:
<div class="my-form"> . . your existing form HTML . </div>
and add this new class in front of your existing css classes on your external form like this:
.my-form .your-class {...}