reset password
Author Message
talisunep
Posts: 140
Posted 02:17 Jan 29, 2013 |

Professor After a user sponsors a project, on the Sponsor This Project link will no longer be shown to that user..that works fine but

i was wondering if the user logs out then then session  invalidates.... when he  logs back in to view the same page then should the sponsor this project link not show anymore on the second login?  is this possible to achieve the result using sessions? 

goldsmic
Posts: 4
Posted 03:09 Jan 29, 2013 |

I indeed implemented the sponsor link in that fashion.  When a user sponsors  a project the corresponding project's sponsor link is hidden.  If that same user logs out and logs back in the visibility of  the project's sponsored link is preserved.  In other words, a user even if they log out and log back in will not be able to sponsor the same project .  In order to implement this you must identify some unique attribute or data that identifies a user, and form a link/relationship with the corresponding project.   This data obviously can not be stored in a session since all session attributes are removed on a logout.  I find it is similiar to linking rewards to projects on the server.  Hope this helped.

talisunep
Posts: 140
Posted 03:24 Jan 29, 2013 |

i tried to do this somehow by creating an user class and  entering the id of the user everytime he/ she sponsors a project....and checking on the display project page later.. works fine after first sponsor link wont show but somehow after i log out and log back in the sponsor  ilnk re appears..all other values like % and pledge amount are maintained but the sponsor link reappears ...i dont know where i am going wrong on this..

goldsmic
Posts: 4
Posted 03:45 Jan 29, 2013 |

I see. Well my approach is not as sophisticated as yours.  What I did was when someone sponsors a project  that persons username is stored in a list of sponsors in the corresponding project.  On the pages with the sponsor link I check for the following

if a user is logged in

if they are is the current session username contained inthe project's list of sponsors

if they are hide link

if they are not display link.

Do you have something similar?

cysun
Posts: 2935
Posted 08:06 Jan 29, 2013 |

Again, when you implement some feature, first think about what data you need, which is the basis for what you can do.

Q: What is the new "data" in HW2?

Pledges.

Q: How do I design class(es) for Pledge?

Well, try to describe it in English then turn the description into a class. For example, "a pledge includes an amount and a reward".

Q: How is Pledge related to other classes?

A Pledge is made by a User; a Project can receive a number of Pledges.

Q: Where do I store Pledges so they will stay there even after the user logs out?

The same place you store Projects and Rewards.

Q: How do I know if a user has sponsored (pledged to) a project?

Check the information you stored in Pledge and/or Project.

talisunep
Posts: 140
Posted 19:24 Jan 29, 2013 |

thank you.. yes GOLDSMIC i did that exactly... its working now i was making a wrong call and not calling the stored user correctly when i went back to the project display page... 

Last edited by talisunep at 19:25 Jan 29, 2013.