Jump to content
xisto Community
nol

User Profile Creating *need Help!*

Recommended Posts

Hey guys,

Basically I'm creating this website, and wish to create a user profile system with my members. Now, I already have a login/register system going on, which is integrated to my SMF (2.0 if it matters) forum. SMF made this possible very easily by using SSI commands such as:

<?phprequire("/home/openpoli/public_html/forums" . '/SSI.php');?>

to connect to the database and call on things such as $context['user']['name'] which would show the person's username (when he is logged in), or things such as

ssi_login($redirect_to = 'http://forums.xisto.com/no_longer_exists/;;

which will show a login form for the user to login, but redirect them back to the homepage which they logged into.

Now I haven't seen from the list of commands that SMF has provided, the one I want for this. I want to create a profile on the website, similar to the one on the forums where you click their profile name, it takes you to their profile which it shows stats. Now I want a seperate one though, they can click on their own name, it'll take them to a page where they can edit profile details. Basically it really isn't a profile as much as a profile center, where they can do certain things such as add a article ( I can build this system on my own), and edit certain details. The problem I'm having is do I need to create a new page per user for them to do this? Or would it be easier to just make one page, and depending on if they are logged in, it'll show the page(I know how to do this), and then from there they can edit certain fields (I somewhat know how to do this, but I'm sure the way I could do it is completely wrong).

In short, how can I create a profile managing center where people can edit certain database entries (for their username) such as their email, (not password), and view certain information for their account (no idea where to do start with this part).

Share this post


Link to post
Share on other sites

Not certain if this will answer your question directly, but...One thing about Database management systems and why they are used for maintaining information has to do with 'data integrity'.meaning, that there should be one, and only one, source of information for the users. If you have name, email, etc available in a database for the SMF Forum, and an SSI feature for the Forum, I would strongly consider using that dataset for the personal profile system. Otherwise, you may end up in a situation where the same user will have 2 emails, 2 user names, etc. and confusion reigns. Back in the good old days, when sequential files were used, this was a serious issue and Databases are the solution, but one Database for the member information is enough. You already have that inside the SMF DB, so use their Profile manager should work (providing the SSI will allow for that).

Share this post


Link to post
Share on other sites

I kind of get what your saying, I'm probably confusing myself thinking about it and it really isn't that hard, I already have the display members username so pretty much its that same exact thing I just need to create another thing somewhat like it? But the one thing I don't really know how to do though is get them to be able to edit their own email etc.

Share this post


Link to post
Share on other sites

In short, how can I create a profile managing center where people can edit certain database entries (for their username) such as their email, (not password), and view certain information for their account (no idea where to do start with this part).

Doesn't SMF already provide this feature?

where they can do certain things such as add a article

Isn't that similar to making topics?
Either way, if you're seeking to make something like an "About Me" page like we have here at the Xisto forums, if SMF doesn't already have that, then that would require (of course) knowledge of the current SMF database structure (mostly to modify certain tables), knowledge of the SMF coding methods (mostly for the sake of reducing redundant code), and modifying certain files, which means knowledge of the SMF file structure.

Share this post


Link to post
Share on other sites

Ya SMF does have those features for editing, but I mean, I don't really want just the email, I want different things that, and SMF does have those kinds of things, but I want to expand, its kind of hard to explain, but anyways, I get this error message when I'm trying to make it based on usergroups? I 'm not really understanding:

Parse error: syntax error, unexpected '{' in /home/openpoli/public_html/profile.php on line 83

And here is that portion of the code,

<?phpif (in_array(1, $user_info['groups']) || in_array(2, $user_info['groups']  || in_array(3, $user_info['groups']  || in_array(4, $user_info['groups']  || in_array(5, $user_info['groups']  || in_array(6, $user_info['groups']  || in_array(7, $user_info['groups']  || in_array(9, $user_info['groups'])){ echo 'Welcome to the profile section! ';if (in_array(1, $user_info['groups']) || in_array(2, $user_info['groups']  || in_array(3, $user_info['groups']  || in_array(4, $user_info['groups']  || in_array(5, $user_info['groups']  || in_array(6, $user_info['groups']  || in_array(7, $user_info['groups']  || in_array(9, $user_info['groups']))		echo 'and';	else		echo 'or';	echo ' 12!';}else{	echo 'We are sorry, it seems you don't have access to this page. Please register or login to view this page.';}?>

The line 83 of the code is:

{ echo 'Welcome to the beta section! ';

Any ideas as to why this would be unexpected {?

Share this post


Link to post
Share on other sites

Any ideas as to why this would be unexpected {?

Yeah, you forgot to escape the single quote for the word "don't" in the else block. It's better to use double quotes for the echo and print statements, it makes things easier to work with. You should consider getting an editor that has syntax highlighting, that is, if you don't already have one. If you're modifying these files straight from your account, consider that like a programming taboo.

Share this post


Link to post
Share on other sites

Yeah, you forgot to escape the single quote for the word "don't" in the else block. It's better to use double quotes for the echo and print statements, it makes things easier to work with. You should consider getting an editor that has syntax highlighting, that is, if you don't already have one. If you're modifying these files straight from your account, consider that like a programming taboo.

Any ideas to where a good editor (preferably free) would be?

Share this post


Link to post
Share on other sites

If you want to extend the current CMS to include more storing of custom information then you would either look at existing extensions available. If there is none available or nothing close that you can further customize then the next step would be to create your own. One way to go about creating your own is to first examine the current database that the CMS uses. Obtain a ERD to help further your understanding of the database, You may need to create your own if the CMS does not share it. I know joomla provides an ERD of their databases. Examine the ERD and extend it to hold fields you require and add tables as needed. Do not include any new fields as to create duplicate data. You must have good knowledge of database design (logical). It helps if you know what your doing. Once tables are created then you go and modify and create new PHP code as your application needs.

Share this post


Link to post
Share on other sites

Yeah, you forgot to escape the single quote for the word "don't" in the else block. It's better to use double quotes for the echo and print statements, it makes things easier to work with. You should consider getting an editor that has syntax highlighting, that is, if you don't already have one. If you're modifying these files straight from your account, consider that like a programming taboo.

So are you trying to say its supposed to be like:

 

<?php								if (in_array(1, $user_info['groups']) || in_array(2, $user_info['groups']  || in_array(3, $user_info['groups']  || in_array(4, $user_info['groups']  || in_array(5, $user_info['groups']  || in_array(6, $user_info['groups']  || in_array(7, $user_info['groups']  || in_array(9, $user_info['groups']))								{								echo "Welcome to the profile section! ";								}								else								{								echo "We are sorry, it seems you don't have access to this page. Please register or login to view this page.";								}						?>

? Otherwise I don't really get what you mean, I'm not really seeing it? Line 83 is the first { in the thing (like 4 in this small peice of code) am I supposed to get rid of the { on that line all together? Or... what? I think I did what you mean by adding double quotes, right?

Share this post


Link to post
Share on other sites

So are you trying to say its supposed to be like?

Since your question implied that replacing the single quotes with double quotes did not fix the problem, i further examined the modified code you have provided and you didn't close many of the in_array() functions within the if condition. The fix would look like this:
<?phpif (in_array(1, $user_info['groups']) || in_array(2, $user_info['groups'])  || in_array(3, $user_info['groups'])  || in_array(4, $user_info['groups'])  || in_array(5, $user_info['groups'])  || in_array(6, $user_info['groups'])  || in_array(7, $user_info['groups'])  || in_array(9, $user_info['groups'])){echo "Welcome to the profile section! ";}else{echo "We are sorry, it seems you don't have access to this page. Please register or login to view this page.";}?>
By the way, you should be able to reduce the if condition with:
if (in_array(array(1,2,3,4,5,6,7,9), $user_info['groups']))
And to answer your other question about a good, free editor: I like to use Geany. In fact, i used Geany's syntax highlight features to figure out your syntax errors.

Share this post


Link to post
Share on other sites

Thank it is working now, the groups part isn't working, but I'll try and fix that when I get home, I have an idea what is going wrong, but thanks I'll download that editor, hopefully I can figure out that kind of stuff now with it :lol:

Share this post


Link to post
Share on other sites

Hi!@nolWould it be possible for you to look for the actual SMF PHP file in which it displays the user profile? You could probably copy-paste it across or you could modify the original file. Perhaps there's a setting/plugin to get SMF to point to the new page for user profiles?You can use either Notepad++ (free text editor) or EclipsePHP (PHP IDE). Notepad++ is a pretty good notepad replacement and it's quick-n-easy just like the original notepad. EclipsePHP is a full-featured IDE (Integrated Development Environment) that is way more than just an editor. It's built on the Eclipse platform so you'll probably find the IDE plugins to be better tested and more stable.BTW, since you've used Simple Machines Forum (SMF), do you have any experience with vBulletin, Invision Power Board, or phpBB to compare it with?Regards

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.