Does Your Pligg Admin Page Sometimes Jam Or Take A While To Load?

Posted on 07. Feb, 2010 by Stuart in Pligg Hacks

Some of you may have noticed that when you login to a pligg installation with administrator privileges and try to access the Admin page it takes forever to load the page. After experiencing these annoying slowdowns ourselves whilst developing our latest theme we decided to poke around and see where the cause of these slowdowns lay.

The first file we looked at within the pligg admin theme titled admin.tpl seemed to hold the answers straight away. Within this file are two instances of code that fetch both of the rss feeds from pligg.com for the admin right hand sidebar Pligg News section.

Removing the code for these RSS feeds and deleting the content from within the cache/admin_c folders of our pligg installs seemed to solve this page jamming problem.

If you want to remove the code to see if it fixes any jamming or the admin page taking eon’s to load follow the instructions below.

1. Goto /templates/admin and open the file admin.tpl and look for the code below. It should be around line 89.

1
                        {checkActionsTpl location="tpl_pligg_admin_sidebar_start"}

2. Under the code snippet above delete everything until you reach the code snippet below around line 203.

1
			{checkActionsTpl location="tpl_pligg_admin_sidebar_end"}

Exactly what you should be deleting is the code below.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
			<div class="side-box">
			<h3>Pligg News</h3>
				<div class="side-box-content">
				{php}
 
				require '../templates/admin/simplepie.inc';
				$url = 'http://www.pligg.com/rss/blog';
 
				function shorten($string, $length)
				{
				// By default, an ellipsis will be appended to the end of the text.
				$suffix = '';
 
				// Convert 'smart' punctuation to 'dumb' punctuation, strip the HTML tags,
				// and convert all tabs and line-break characters to single spaces.
				$short_desc = trim(str_replace(array("\r","\n", "\t"), ' ', strip_tags($string)));
 
				// Cut the string to the requested length, and strip any extraneous spaces 
				// from the beginning and end.
				$desc = trim(substr($short_desc, 0, $length));
 
				// Find out what the last displayed character is in the shortened string
				$lastchar = substr($desc, -1, 1);
 
				// If the last character is a period, an exclamation point, or a question 
				// mark, clear out the appended text.
				if ($lastchar == '.' || $lastchar == '!' || $lastchar == '?') $suffix='';
 
				// Append the text.
				$desc .= $suffix;
 
				// Send the new description back to the page.
				return $desc;
				}
 
				$feed = new SimplePie();
				$feed->set_feed_url($url);
				$feed->init();
 
				// default starting item
				$start = 0;
 
				// default number of items to display. 0 = all
				$length = 5; 
				$shortdesc = 40;
 
				// set item link to script uri
				$link = $_SERVER['REQUEST_URI'];
 
				// loop through items
				foreach($feed->get_items($start,$length) as $key=>$item)
				{
 
				// set query string to item number
				$queryString = '?item=' . $key;
 
				$link = $item->get_link();
				$queryString = '';        
 
				// display item title and date    
				echo '<h4 style="padding-top:6px;"><a href="' . $link . $queryString . '">' . shorten($item->get_title(), 33) . '</a></h4>';
				echo ' <p style="padding-bottom:4px;"><span style="font-size:12px;line-height:13px;">',shorten($item->get_description(), 133),'...</span></p>';
 
				echo '';
				}
 
				{/php}
				</div>
			</div>	
 
			<div class="side-box">
			<h3>New Products</h3>
				<div class="side-box-content">
				{php}
				$url = 'http://www.pligg.com/rss/products';
 
				$feed = new SimplePie();
				$feed->set_feed_url($url);
				$feed->init();
 
				// default starting item
				$start = 0;
 
				// default number of items to display. 0 = all
				$length = 5; 
				$shortdesc = 40;
 
				// set item link to script uri
				$link = $_SERVER['REQUEST_URI'];
 
				// loop through items
				foreach($feed->get_items($start,$length) as $key=>$item)
				{
 
				// set query string to item number
				$queryString = '?item=' . $key;
 
				$link = $item->get_link();
				$queryString = '';        
 
				// display item title and date    
				echo '<li><a href="' . $link . $queryString . '">' . shorten($item->get_title(), 33) . '</a></li>';
				// if single item, display content
				if(isset($_GET['item']))
 
				echo '';
				}
 
				{/php}
				</div>
			</div>

This will completely remove the Pligg News boxes on the right hand side of you admin panel.

3. Goto cache/admin_c and delete any cache files that have been placed there.

This is more of a hack than a fix but it worked for us and now our admin panels load without jamming from time to time and taking 3 – 5 minutes to load on occassion.

Tags: , , ,

3 Responses to “Does Your Pligg Admin Page Sometimes Jam Or Take A While To Load?”

  1. Pliggs 8 February 2010 at 12:43 pm #

    Good post, that’s the first thing we do on ALL new Pligg installs.

  2. WebDezinz 9 February 2010 at 2:08 am #

    Yea – first thing I did remove anything that connected to me from Pligg once I noticed that when their site was down, mine took forever to load. I don’t even use the update mods they have.

  3. thamilbests 17 April 2010 at 2:10 pm #

    its really help full…

    last time when the Pligg site was down i cant even log in to admin.

    Thanks


Leave a Reply