Stand Alone Notepad
Posted: 24 May 2008 02:04 AM   [ Ignore ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  15368
Joined  05-15-2004

I am trying to get the member’s notepad to display in a public template. This works fine, actually:

<?php global $SESS; ?>

{exp
:query sql="SELECT notepad, notepad_size FROM exp_members
WHERE member_id = '<?=$SESS->userdata['member_id'];?>'"
}
<form method="post" action="{path=member/update_notepad}">
   <
input type="hidden" name="notepad_size" value="{notepad_size}" />
   <
textarea name="notepad" rows="{notepad_size}" cols="120">{notepad}</textarea>
   <
input type="submit" value="Update" />
</
form>
{/exp:query}

If they change anything and hit “Submit”, however, they are taken to the members templates. I’d rather they stayed on the site, such as with the notepad in the control panel. I’d need no visual feedback, either. How could I accomplish that easily? Some AJAX?

I suppose I could simply write the {notepad} back to the db with an UPDATE query, but I feel there must be a simpler way.

 Signature 

Everything will be good in the end. If it’s not good, it’s not the end.

Profile
MSG
 
 
Posted: 24 May 2008 03:15 AM   [ Ignore ]   [ # 1 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  6543
Joined  04-15-2006

Hi Ingmar,

If you use this AJAX form script then it will do exactly what you are asking I believe. Basically you just build your form in the exact way that is needed to ensure that the data gets placed wherever you need it and then this is where the form script takes over. It will basically send the data in the same way that the form would have done and afterwards you are free to do whatever you like. You could show a message to say that the data has been updated or re-direct to a completely different place of your choosing, whatever you like basically.

If you don’t mind my asking, what exactly are you using this for and the reason I ask is I’m just wondering why you aren’t just using the regular member area for people to update their information?

Anyway, hope that helps, it should do hopefully?

Best wishes,

Mark

 Signature 

Full List Of Plugins Here!! (16)
 
Retrieve Statuses
Maximum Posts Reached
Neat Link
Redirect
Fetch URI

Profile
 
 
Posted: 24 May 2008 04:21 AM   [ Ignore ]   [ # 2 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  15368
Joined  05-15-2004

Thanks, Mark, that works beautifully. Why am I doing this, you ask? Well, I don’t need most of the rest of the member functionality, but I have a sort of “dashboard” page for certain members, and wanted to include the notepad there. Nothing fancy, I assure you.

 Signature 

Everything will be good in the end. If it’s not good, it’s not the end.

Profile
MSG
 
 
Posted: 24 May 2008 04:26 AM   [ Ignore ]   [ # 3 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  6543
Joined  04-15-2006

Ah right, that would explain it then wink

Let us know how it all goes and perhaps a link if you can link to the site that is - when it is all ready.

Best wishes,

Mark

 Signature 

Full List Of Plugins Here!! (16)
 
Retrieve Statuses
Maximum Posts Reached
Neat Link
Redirect
Fetch URI

Profile
 
 
Posted: 24 May 2008 04:33 AM   [ Ignore ]   [ # 4 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  15368
Joined  05-15-2004

Unfortunately this will be a closed extranet, sorry, no links grin

 Signature 

Everything will be good in the end. If it’s not good, it’s not the end.

Profile
MSG
 
 
Posted: 24 May 2008 04:49 AM   [ Ignore ]   [ # 5 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  6543
Joined  04-15-2006

Ah well never mind. Had to ask as thought it would be good to see this sort of thing in action.

Hope it all goes well for you.

Best wishes,

Mark

 Signature 

Full List Of Plugins Here!! (16)
 
Retrieve Statuses
Maximum Posts Reached
Neat Link
Redirect
Fetch URI

Profile
 
 
Posted: 12 June 2008 12:51 AM   [ Ignore ]   [ # 6 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  507
Joined  04-23-2006

Very neat idea!
I’ve just also implemented this on my intranet site!
smile

 Signature 

OLD username was jammo, NEW username is OrganizedFellow

It’s a struggle even to keep focused. This is the best of my AD/HD & GTD.
The exceptionally slow growth of my web dev projects is eclipsed by my patience, understanding and desire to learn AS MUCH AS POSSIBLE as I slowly progress.

Profile
 
 
Posted: 12 June 2008 01:01 AM   [ Ignore ]   [ # 7 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  15368
Joined  05-15-2004

Yes, I quite like it, too. I wrote this up for the wiki as well, FWIW; feel free to add anything there.

 Signature 

Everything will be good in the end. If it’s not good, it’s not the end.

Profile
MSG
 
 
Posted: 22 August 2008 12:00 AM   [ Ignore ]   [ # 8 ]  
Summer Student
Total Posts:  3
Joined  01-11-2006

After following this thread & wiki I still get redirected to the member templates. I think I’m missing something here… Should one change the action=”{path=member/update_notepad}” to a different page ?

Profile
 
 
Posted: 30 August 2008 04:22 PM   [ Ignore ]   [ # 9 ]  
Grad Student
Rank
Total Posts:  33
Joined  08-12-2007

This is pretty cool, thanks for sharing

I guess it could be worth noting that the member_group must to have CP access privileges for this to work.  wink

Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 09:33 AM
Total Registered Members: 64909 Total Logged-in Users: 45
Total Topics: 81853 Total Anonymous Users: 30
Total Replies: 440067 Total Guests: 232
Total Posts: 521920    
Members ( View Memberlist )