1
vinit
CODING: Support needed for coding index.php
  • 2004/10/16 5:09

  • vinit

  • Just can't stay away

  • Posts: 530

  • Since: 2004/1/10


hi,

Could some one guide me about how to implement the given below scenario.

Quote:


When ever a user logs in check if his "Real Name" and "Extra Info" field is empty or not. If its empty redirect him to edit user page else to main page.



All i need to do is a db querry to check the count of this fields and if the count is 0 or below X number than redirect to edit page.

Could some one give me working example of the code.

2
vinit
Re: CODING: Support needed for coding index.php
  • 2004/10/27 5:31

  • vinit

  • Just can't stay away

  • Posts: 530

  • Since: 2004/1/10


Can some developers or module coders look into this and lend me some helping hand.

3
Mithrandir
Re: CODING: Support needed for coding index.php

if (($user->getVar('name') == '') || ($user->getVar('bio') == '')) {
    
redirect_header(XOOPS_URL.'/edituser.php'1sprintf(_US_LOGGINGU$user->getVar('uname')));
}


in include/checklogin.php line 100
between
$notification_handler->doLoginMaintenance($user->getVar('uid'));
and
redirect_header($url, 1, sprintf(_US_LOGGINGU, $user->getVar('uname')));

4
vinit
Re: CODING: Support needed for coding index.php
  • 2004/10/28 3:36

  • vinit

  • Just can't stay away

  • Posts: 530

  • Since: 2004/1/10


Thanks Mithrandir, it worked perfectly.

Now next thing thats needed is if user clicks on submit button on edituser.php without filling up the "Real Name" and "Extra Info" field than a proper error message has to be shown and should be redirected back to edituser.php.

i think this has to be done in edituser.php somewhere after line 52.

I thought of this, could you verify wether this is right or not

Quote:

if (empty($name) ) {
$errors[]=_US_EMPTYREALNAME;
}

if (empty($bio) ) {
$errors[]=_US_EMPTYEXTRAINFO;
}



Do let me know if i am wrong.

5
vinit
Re: CODING: Support needed for coding index.php
  • 2004/10/28 6:36

  • vinit

  • Just can't stay away

  • Posts: 530

  • Since: 2004/1/10


Looks like the code is ok but the result is not as expected.

edituser.php
Quote:

if (count($errors) > 0) {
include XOOPS_ROOT_PATH.'/header.php';
echo '
';
foreach ($errors as $er) {
echo ''.$er.'
';
}
echo '

';
$op = 'editprofile';
} else {


The above post code works fine. When ever the Real name is blank or Extra info is blank it gives the relevant error message. Only problem is that the error message is not comming at the place where its expected. Rather the the first line of the html page contains the error message and then comes the code of the page. Where as i was expecting header to come first and then the error message. Given below is what i see as html source code once the page is generated

Quote:

Real Name is missing





Some how the error message is comming before the header. Am i missing something here.. could you look into this please.
Thanks

6
vinit
Re:CODING: Support needed for coding index.php
  • 2004/10/28 16:32

  • vinit

  • Just can't stay away

  • Posts: 530

  • Since: 2004/1/10


stuck :(
No solution in hand as of now. And not being able to debug why the "header" is not comming.

7
Mithrandir
Re:CODING: Support needed for coding index.php

A simpler solution might be to add these fields to the required fields - however, that will only work if your users have javascript enabled.

//line 140
$form->addElement($name_text);

//change to
$form->addElement($name_texttrue);


for the name and

//line 210:
$form->addElement($bio_tarea);

//change to
$form->addElement($bio_tareatrue);

for the extra info

8
vinit
Re:CODING: Support needed for coding index.php
  • 2004/10/30 4:38

  • vinit

  • Just can't stay away

  • Posts: 530

  • Since: 2004/1/10


hmmm

Thanks Mith's

its working smoothly.

Login

Who's Online

376 user(s) are online (289 user(s) are browsing Support Forums)


Members: 0


Guests: 376


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits