• Index
  • » Users
  • » 4thdimension
  • » Posts

Posts

Posts

Actually it's a live site, I've been trying to do the work on it early morning / late at night.
Let me know what works best for you.

Thanks

So In my never ending endeavor to learn, I tried to modify the script on my own.  I found out the URL for Mighty registration is the following:

index.php?option=com_juser&view=user&layout=mydetails

So I modified your script and got it to work, it takes the user to the correct details page, but it throws a 500 error once I type in the password field.  At that point it locks up the site and I have to manually uninstall everything to get it running correctly again.

Here's how I modified your scrip Maybe it would be something simple to fix:


            <?php

// no direct access
defined('_JEXEC') or die('Restricted access');

jimport('joomla.plugin.plugin');

class plgSystemForcePasswordChange extends JPlugin
{
    function plgSystemForcePasswordChange(&$subject, $config)
    {
        parent::__construct($subject, $config);
    }

    function onAfterRoute()
    {
        $user = &JFactory::getUser();

        $option = JRequest::getVar('option');
        $view = JRequest::getVar('view');
        $task = JRequest::getVar('task');
        $layout = JRequest::getVar('layout');

        if(!$user->guest && $user->lastvisitDate == "0000-00-00 00:00:00")
        {
            // The user is not a guest and their lastvisitDate is zeros

            if($option == "com_juser" && $task == "save")
            {
                // The user is saving their profile

                // Set the last visit date to a real value so we won't continue forcing them to update their profile
                $user->setLastVisit();
                $date = JFactory::getDate();
                $user->lastvisitDate = $date->toMySQL();
            }
            else if(!($option == "com_juser" && $view == "user" && $layout == "mydetails"))
            {
                // The user is not on the edit profile form

                // Update lastvisitDate back to zero
                $dbo = &JFactory::getDBO();
                $query = "UPDATE #__users ".
                    "SET lastvisitDate = ".$dbo->quote("0000-00-00 00:00:00")." ".
                    "WHERE id = ".$dbo->quote($user->id);
                $dbo->setQuery($query);
                $dbo->query();
   
                // Redirect to edit profile
                $app = &JFactory::getApplication();
                $app->redirect(
                    "index.php?option=com_juser&view=user&layout=mydetails",
                    $this->params->get("message", "You must update your password before continuing to use the site.")
                );
            }
        }
    }
}





Thanks again for all your help, I really do appreciate this a lot!

I think that would work... thanks a lot for your help!

Also the info provided by Mighty Registration is here:

<!-- m --><a class="postlink" href="http://www.mightyextensions.com/knowledge-base/faq/list/answers/12-user">http://www.mightyextensions.com/knowled ... rs/12-user</a><!-- m -->

So I tried it, and it worked perfect! Except for one thing... I'm using mighty registration to gather additional info from my users, and the main point for me wanting to do this is to get my users to update all of their details.  So when I run the plugin it takes them to the Main joomla registration page.  I think I could make this work by updating the "forcepasswordchange.php" and changing "com_user" to "com_juser"  But I'm stuck on the "Redirect to edit profile" link.  I don't know the location of the Mighty Registration edit profile link.

Thanks again for all your help!!!

The plugin you created, "force password check" is very close to what I've been searching for, but I need it to force every user to reset their password / update their details on next login. I tried modifying the code, but was unsuccessful. Any help you could give me would be greatly appreciated.

Thanks!

  • Index
  • » Users
  • » 4thdimension
  • » Posts

Board Info

Board Stats
 
Total Topics:
11616
Total Polls:
0
Total Posts:
48818
Posts today:
7
User Info
 
Total Users:
47667
Newest User:
jaiama
Members Online:
8
Guests Online:
1159

Social Stream
SourceCoast Joomla Social Extensions
Friday, 25 May 2018
JFBConnect 8.0 Coming Soon! Stay tuned.
Refer and Earn

Like our extensions? You're not alone! That's why they're used on tens of thousands of websites. Now you can earn 20% of any sale you refer to SourceCoast.com.

We provide excellent documentation, well laid out sales pages and great support. All you need to do is spread the word and we'll take care of the rest.

Learn About Our Affiliate Program