Making a new external edit profile page for users & more

Share your CuteNews.RU skins and code snippets.

Making a new external edit profile page for users & more

Postby DarkSlim » Mon Jan 25, 2010 1:16 pm

Sorry to keep you waiting, typeman has asked me to help him with
this, it might be helpful for others, he wanted to make a nice www.domain.com/editprofile.php
page styled for users to use, here is what you need to do:

Copy inc/mod/personal.mdu to the same folde and rename it
for example personalusers.mdu
This will be the edit profile page for you users, at the moment
it looks the same, but for it to perfectly work the same you
need to change couple of things in it from "personal"
to the new name "personalusers":

Find (if you can find the rows in the file search for parts of the code as I might have edited some):
Code: Select all
<form method="post" action="<?=$PHP_SELF; ?>" name="personal"...

Change to personalusers.

Find:
Code: Select all
  <input type="submit" value="<?=$echo['save']; ?>" accesskey="s">
  <input type="hidden" name="mod" value="personal">

Change again.

Find:
Code: Select all
   echo '<div style="vertical-align:text-top;">';
   msg('info', $echo['headerSaved'], $echo['changeSaved'].$avatar_error, $PHP_SELF.'?mod=personal');

Change here too.

I don't remember it all, but I don't think there were any other
fixes needed, also you might need to open a lang file: inc/lang/../personalusers.ini
just copy personal.ini and rename it.

Now create a new page in your wwwroot called for example usersprofile.php or so,
we will use it to call our new personalusers page.
You can style it as you want, just include the head.php
Now where you want the edit profile to show - use this code I've written (you can play with it):
Code: Select all
<!------ DarkSlim - Users Edit Profile------>
<? if (!$is_logged_in){ ?>
<div align="center">
   <br><br> Please log-in to edit your profile.<br><br><br><br>
</div>

<?
}

elseif ($is_logged_in){
?>

<iframe name="userseditprofile" src="path/to/cnr/index.php?mod=personalusers" width="550" height="650" frameborder="0" marginheight="0" marginwidth="0"  align="center">
  <font size="2">Yout browser doesn't support iFrames.</font>
</iframe>

<?
}
?>


You can change the code and iframe to suit your needs, if someone is logged-in he will see the
edit profile page if not he will get a message accordingly. :)

You can also place a button using this method that will be shown only
when the user is logged in, for example:
Code: Select all
<? if ($is_logged_in){ ?>
  <a href="usersprofile.php">Edit Profile</a>
<?
}
?>


That's about it, now you can edit personalusers.mdu, style it, add or delete fields etc'..
without it affecting the CNR original personal.mdu ;)

Hope it helps, if you find it usefull and want more
support, plugins and hacks you can donate
directly to me using the link in my signature
Thanks you :)
User avatar
DarkSlim
 
Posts: 298
Joined: Thu Aug 06, 2009 4:18 pm
Location: IL

Return to Skins and snippets



Who is online

Users browsing this forum: No registered users and 3 guests

cron