21
rpilney
Re: Purging notifications and PMs from the database: How
  • 2007/7/10 20:52

  • rpilney

  • Just popping in

  • Posts: 76

  • Since: 2006/1/25


where would I or how do I use this script? This is what I need but not sure how to go about doing it.

Thanks!

Quote:

irmtfan wrote:
at least about pm i do it without any problem for 2 years.
i use a very simple script:
<?php
define
("user""dbuser");
define("pass""dbpass");
define("host""localhost");
define("db""dbname");


$cxn mysql_connect(host ,userpass);
mysql_select_db(db);

$delete_time time() - ( 30 24 60 60 );  // 30 days/month * 24 hrs/day
// * 60 minutes/hour * 60 seconds/min.

$sql "DELETE from `xoops_priv_msgs` WHERE `read_msg` = '0' AND `msg_time` < '$delete_time'";
//This script would delete everything older than 30 days that has been not read.

$result mysql_query($sql$cxn);
?>

and run it every day with a cron.

MP manager can purge pm too but i dont use it because i need to do it automatically every day.

and about notification its in the Herve todo list for the future version of his new module xoopscare.



22
rpilney
Re: database hangs when site loads
  • 2007/5/24 20:15

  • rpilney

  • Just popping in

  • Posts: 76

  • Since: 2006/1/25


yep I am using cache settings in my site. Helps allot. So with godaddy I get 25 DB's of MySQL for free. I had setup 12 or so but was only using 4 for various things. They tell me I am only limited on DB size by the amount of storage I get with my site which is 100 gigs.

My DB for XOOPS is only 25 mgs so that did not make since. Either way I decided to go and delete all the DB's not being used. No my site loads better than ever.

I don't know why that is or what the cause was. Most of the db's I setup were ones that I was trying to figure things out with about 18 months ago that most had nothing in them.

Doesn't make much since to me but it is working now. So my only tip for people with an issue like this is to delete unused databases if your use godaddy.

Thanks!

Quote:

shalommemphi wrote:
I am familiar with GoDaddy, and wan't excited using them for my sql database it was even limited I believe in uploading my sql files from my prior hosting company, was going to have to break the files up into smaller ones. I personally have been happy with bluehost.com service. Nothing wrong with GoDaddy either but like you said, you don't get access to some helpful tools and info.

Note: They still should be able to confirm if the sql servers are having heavy loads on them to help you in confirming your problem.

Are you using cache options in your site setup?



23
rpilney
Re: database hangs when site loads
  • 2007/5/23 20:14

  • rpilney

  • Just popping in

  • Posts: 76

  • Since: 2006/1/25


I asked them and they said they don't have that to share with me. yep it's the cheap one. Godaddy.

I have been on the phone with them off and on for days. sometimes the site loads fine and others it just times out.

driving me crazy and I am not technically skilled enough to make them jump hoops.

I have a few friends a little more skilled than I am that have tried to help. Example pinged the sql server and no connect well come to find out they don't allow that anyway.



24
rpilney
database hangs when site loads
  • 2007/5/23 19:33

  • rpilney

  • Just popping in

  • Posts: 76

  • Since: 2006/1/25


I went through a few pages of posts and searched the site but did not find anything specific to this topic and if there is please forward me that direction.

My MySQL database that XOOPS uses loads the site in about 4-5 minutes and will do that for a day or so then be fine. It was fine for about 18 months without issue. My hosting company says it has to do with my database and not them. I have the xoopscare module on there and run the optimize and repair.

I also have the optimize module and ran that and showed everything optimized.

My database is roughly 25 megs.

Any ideas for a very green person at this? I can set up the site and such but not much good with a database.

Thanks,
Roger



25
rpilney
Re: MP Manager 2.5 help please
  • 2007/3/2 16:34

  • rpilney

  • Just popping in

  • Posts: 76

  • Since: 2006/1/25


I actually have removed this from my site as of today.

I was given some good advice from someone much more Knowledgeable on XOOPS than I am:

Quote:
I recommend you take the MPmanager module down. Although the original PM is not very nice (powerful?) at least it doesn't kill XOOPS sites. My experience and my colleagues as well, is that this module is not really ready for prime time. The MPmanager installation changes too many core XOOPS files, which introduces a lot of site instability and weirdness- just like that which you are experiencing.


I did notice a slowing of my site when I installed it. I was super impressed by all the functionality of it but never got it to work just right. After reaching out to others more skilled in this area I took it down. After I worked out the bugs when I removed it the site speed increase on load time. Maybe a fluke that it did but for now I will just hold on to the module and use it in the future at some point.



26
rpilney
Re: MP Manager 2.5 help please
  • 2007/3/1 16:53

  • rpilney

  • Just popping in

  • Posts: 76

  • Since: 2006/1/25


cool I edited the user.php but when I use that other edit for checklogin.php it hangs still

Quote:

DarinAllan wrote:
Ok that is different to what I have, I see you have an auto login hack. The lines in blue you have included are different to mine, I am lost now lol. this is what I have in my read_me file, well two steps that I have that are similar to that blue highlight

#################################################

Modify <xoops_root>/user.php

#################################################



-Find

redirect_header('user.php',5,_US_ACTLOGIN);

or

redirect_header( 'user.php', 5, _US_ACTLOGIN, false );



-Add theses 2 lines just above:

require_once XOOPS_ROOT_PATH . '/modules/mpmanager/include/functions.php';

mpauto($id);





#################################################

Modify <xoops_root>/register.php

#################################################



-Find:

redirect_header('index.php', 4, _US_ACTLOGIN);



-Add theses 2 lines just above:

require_once XOOPS_ROOT_PATH . '/modules/mpmanager/include/functions.php';

mpauto($newid);

Maybe we have a different version, or have you changed it for your own situation, am I missing something, I don't see checklogin.php mentioned is that part of the autologin hack lol. Maybe I am on the wrong page (cognitive functions aint so good these days) ;o) Hopefully someone else can help, Good luck and I am glad you got back into your site.

I am so lost what version of XOOPS are you using? Anyway I am off to the land of nod. Cheers.



27
rpilney
Re: MP Manager 2.5 help please
  • 2007/3/1 16:43

  • rpilney

  • Just popping in

  • Posts: 76

  • Since: 2006/1/25


here is my readme file. I downloaded 2.5 version



#################################################
WARNING! BACKUP ANY FILES BEFORE MODIFYING!
#################################################

#################################################
Copy all files from 'root' folder
#################################################

Respect the tree structure of the folders

function.xoManager.php (new file)
function.xoManagerCount.php (new file)
function.xoManagerCountAll.php (new file)
pmlite.php (overwrite the existing file)


#################################################
Modify <xoops_root>/include/checklogin.php
#################################################

-Find
$user->setVar('last_login', time());


-Add theses 2 lines just above:
//Hack MpManager
require_once XOOPS_ROOT_PATH . '/modules/mpmanager/include/functions.php';
mpauto($user);
//


#################################################
Modify <xoops_root>/register.php
#################################################

-Find:
redirect_header('index.php', 4, _US_ACTLOGIN);

-Add theses 2 lines just above:
require_once XOOPS_ROOT_PATH . '/modules/mpmanager/include/functions.php';
mpauto($newid);


#################################################
MANAGEMENT OF THE TEMPLATES
#################################################

CAUTION! If you use a version <2.0.14, you must clone the template and configure the Preferences of the site to be able to use them.

Open /modules/system/templates/blocks/system_block_user.html

-Find:
<{if $block.new_messages > 0}>
<a class="highlight" href="<{$xoops_url}>/viewpmsg.php">
<{$block.lang_inbox}> (<span style="color:#ff0000; font-weight: bold;">
<{$block.new_messages}></span>)</a>
<{else}>
<a href="<{$xoops_url}>/viewpmsg.php"><{$block.lang_inbox}></a>
<{/if}>

-replace by :
<{if $block.new_messages > 0}>
<a class="highlight" href="<{$xoops_url}>/modules/mpmanager/msgbox.php">
<{$block.lang_inbox}>(<span style="color:#ff0000; font-weight: bold;">
<{$block.new_messages}></span>)</a>
<{else}>
<a href="<{$xoops_url}>/modules/mpmanager/msgbox.php"><{$block.lang_inbox}></a>
<{/if}>
<{xoManager}>

If you use a version >2.0.14, you can use the overload of templates.
Copy the file /modules/system/templates/blocks/system_block_user.html in your folder's theme.
/themes/folder_theme/modules/system/blocks/system_block_user.html

Then carry out the changes given above.

################################################

Open /modules/system/templates/system_userinfo.html

-Find:
<input type="button" value="<{$lang_inbox}>" onclick="location='viewpmsg.php'" />

-replace by :
<input type="button" value="<{$lang_inbox}>" onclick="location='modules/mpmanager/msgbox.php'" />

If you use a version >2.0.14, you can use the overload of templates.
Copy the file /modules/system/templates/system_userinfo.html in your folder's theme.
/themes/folder_theme/modules/system/system_userinfo.html

Then carry out the changes given above.


#################################################
PERMISSIONS
#################################################

- Go to mpmanager's Administration to define the permissions.



28
rpilney
Re: MP Manager 2.5 help please
  • 2007/3/1 16:00

  • rpilney

  • Just popping in

  • Posts: 76

  • Since: 2006/1/25


well i just restored the other checklogin.php and I can get back in so looks like I am on to something.

this is what the code looks like (with the code I am supposed to insert). I made the color of that code I added blue just to make it easier to see in here. Not actually how it is in the file. FYI

Quote:
if (!defined('XOOPS_ROOT_PATH')) {
exit();
}
include_once XOOPS_ROOT_PATH.'/language/'.$xoopsConfig['language'].'/user.php';
$uname = !isset($_POST['uname']) ? '' : trim($_POST['uname']);
$pass = !isset($_POST['pass']) ? '' : trim($_POST['pass']);
if ($uname == '' || $pass == '') {
redirect_header(XOOPS_URL.'/user.php', 1, _US_INCORRECTLOGIN);
exit();
}
$member_handler =& xoops_gethandler('member');
$myts =& MyTextsanitizer::getInstance();
// start uname/email login hack SRAJ
//$user =& $member_handler->loginUser($myts->addSlashes($uname), $myts->addSlashes($pass));
$uname4sql = addslashes( $myts->stripSlashesGPC($uname) );
$pass4sql = addslashes( $myts->stripSlashesGPC($pass) );
if (checkEmail($uname)) {
$user =& $member_handler->loginUserEmail($uname4sql,$pass4sql);
} else {
$user =& $member_handler->loginUser($uname4sql,$pass4sql);
}
// hack end
if (false != $user) {
if (0 == $user->getVar('level')) {
redirect_header(XOOPS_URL.'/index.php', 5, _US_NOACTTPADM);
exit();
}
if ($xoopsConfig['closesite'] == 1) {
$allowed = false;
foreach ($user->getGroups() as $group) {
if (in_array($group, $xoopsConfig['closesite_okgrp']) || XOOPS_GROUP_ADMIN == $group) {
$allowed = true;
break;
}
}
if (!$allowed) {
redirect_header(XOOPS_URL.'/index.php', 1, _NOPERM);
exit();
}
}
// start autologin hack SRAJ
if (!empty($_POST['rememberme'])) {
$actkey = $user->getVar('actkey');
if (empty($actkey)) {
$actkey = substr(md5(uniqid(mt_rand(), 1)), 0, 8);
$user->setVar('actkey',$actkey);
}
// be frindly to sites hosting more than one xoops
$xoops_cookie_path = defined('XOOPS_COOKIE_PATH') ? XOOPS_COOKIE_PATH : preg_replace( '?http://[^/]+(/.*)$?' , "$1" , XOOPS_URL ) ;
if( $xoops_cookie_path == XOOPS_URL ) $xoops_cookie_path = '/' ;
$expire = time() + (defined('XOOPS_AUTOLOGIN_LIFETIME') ? XOOPS_AUTOLOGIN_LIFETIME : 604800 ); // 1 week default
setcookie('autologin_uname', $uname, $expire, $xoops_cookie_path, '', 0);
setcookie('autologin_key', md5($actkey), $expire, $xoops_cookie_path, '', 0);
}
// end hack
}

require_once XOOPS_ROOT_PATH . '/modules/mpmanager/include/functions.php';
mpauto($user);


}
$user->setVar('last_login', time());
if (!$member_handler->insertUser($user)) {
}
$_SESSION = array();
$_SESSION['xoopsUserId'] = $user->getVar('uid');
$_SESSION['xoopsUserGroups'] = $user->getGroups();
if ($xoopsConfig['use_mysession'] && $xoopsConfig['session_name'] != '') {
setcookie($xoopsConfig['session_name'], session_id(), time()+(60 * $xoopsConfig['session_expire']), '/', '', 0);
}
$user_theme = $user->getVar('theme');
if (in_array($user_theme, $xoopsConfig['theme_set_allowed'])) {
$_SESSION['xoopsUserTheme'] = $user_theme;
}
if (!empty($_POST['xoops_redirect']) && !strpos($_POST['xoops_redirect'], 'register')) {
$parsed = parse_url(XOOPS_URL);
$url = isset($parsed['scheme']) ? $parsed['scheme'].'://' : 'http://';
if (isset($parsed['host'])) {
$url .= isset($parsed['port']) ?$parsed['host'].':'.$parsed['port'].trim($_POST['xoops_redirect']): $parsed['host'].trim($_POST['xoops_redirect']);
} else {
$url .= xoops_getenv('HTTP_HOST').trim($_POST['xoops_redirect']);
}
} else {
$url = XOOPS_URL.'/index.php';
}

// RMV-NOTIFY
// Perform some maintenance of notification records
$notification_handler =& xoops_gethandler('notification');
$notification_handler->doLoginMaintenance($user->getVar('uid'));

redirect_header($url, 1, sprintf(_US_LOGGINGU, $user->getVar('uname')));
} else {

redirect_header(XOOPS_URL.'/user.php',1,_US_INCORRECTLOGIN);
}
exit();
?>



29
rpilney
Re: MP Manager 2.5 help please
  • 2007/3/1 15:53

  • rpilney

  • Just popping in

  • Posts: 76

  • Since: 2006/1/25


appreciate the reply. For now I have it visible in the User Menu because when I click on the Inbox it only shows the old one. heck I just tried to login to my site and now I can't. Hangs at url/user.php so sounds like i messed up on the checklogin.php edit??

grrrrrrrrrrrrr

Quote:

DarinAllan wrote:
Assuming you have done all the steps correctly it should all work, but you know that ;o)

You didn't mention if you had done this I don't think, "from the read_me"

"- Go to mpmanager's Administration to define the permissions."

Oh and yeah the inbox as such doesn't change in that it's the same one except hacked/modified/modularised or however you want to describe it, the appearance does change when you go into the inbox, but essentially it's still the same inbox as such, well that's how I see it, but has cool extra features and looks a bit fancier lol.

I don't have it as a link in my main menu I gave that a value of 0 in Admin (would only confuse users lol) but I am sure you know this. Have a look in the MP-Manager module Admin Preferences and the Permissions in particular and check the options, have a play if you haven't already.

Other than that you may have to check that you have followed all steps in the read me and I think there is an example text file as well.

Sorry it's been a while since I installed it, and honestly I just did what the instructions said and it worked after setting everything up.

I hope I have understood your post and I have at least helped a little, sorry if I went over something that you already knew ;o)



30
rpilney
MP Manager 2.5 help please
  • 2007/3/1 14:04

  • rpilney

  • Just popping in

  • Posts: 76

  • Since: 2006/1/25


OK It sort of works on my site. Meaning if I make it visible in the User Menu you can access it there but the normal inbox has not changed. I went through the readme file and changed each file found in the root folder with this .rar file for the module.

The new message notification does not work (audible etc) but the new PM notification email does work. I am guessing that is the case because the old inbox is still functioning.

I updated the module after I added the files per the readme suggestions as well as updated the system module and that did not do it.

I cleared the cache folder on the site thinking maybe that was the issue.

I went over and over the readme file but I was really tired so I am sure I made an edit incorrectly or did not do something.

I am sure there is something I missed but I do not know for sure what.

What do I do to make it where I do not have the old inbox any longer and make this new module replace the old one?

I read in earlier posts that there would not be 2 inboxes and that I see very few having any issues with this module so I know the error has to be something I have done or not done yet.

Advice please?




TopTop
« 1 2 (3) 4 5 6 7 »



Login

Who's Online

172 user(s) are online (113 user(s) are browsing Support Forums)


Members: 0


Guests: 172


more...

Donat-O-Meter

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

Latest GitHub Commits