Forum Replies Created

Viewing 15 replies - 31 through 45 (of 60 total)
  • Thread Starter ahau

    (@ahau)

    It is performing superbly!

    The smallest one only has 6 names, the largest one has 1180 names with the average around 400 – 600 names and the name directory name table has a total of 19,235 records. I still have a list of over 30,000 names (no duplicates in that either) that I have not added yet as I need to get my site live (transfering data) and once that is done I will be breaking those 30,000 names into smaller directories – and probably having duplicates. Good thing I bookmarked the post about how to remove the no dups so when I installed the upgrade I then hacked the code again ??

    Of course the normal wp search would not search them but trial and error I found the relavansi search plugin that will search short codes so a happy camper! Sadly if pagination is on the front end it will not search the other pages just the first one. I have written a couple of plugins for other data I had that would not fit into any plugin and found that limitation so I removed my pagination on the front end so I could get full search with the search plugin. I did look for another plugin that would do that but no luck, so may I suggest if you do put pagination in the front end that it is an option as I do not want it! *LOL*

    When I say search, I mean just to be able to search by the directory name – similar to how on the posts page you can search by post name. Would make life alot easier when someone with say 86 directories is trying to find one from a very long list!

    Thank you for your time and work – it is very much appreciated ??

    • This reply was modified 7 years, 2 months ago by ahau.
    Thread Starter ahau

    (@ahau)

    Much appreciated! ??

    Thread Starter ahau

    (@ahau)

    Thank you for your reply – it is appreciated ??

    Thread Starter ahau

    (@ahau)

    Thank you for the reply @sterndata. I had tried relenanssi and while it will do a search of the forums it will not give the correct URL. It will work on the first page of the plugins but not the paginated ones. I did ask at their forum but it is not something that it covers.

    Will try the search everything.

    Thread Starter ahau

    (@ahau)

    I ran that sql and still can not see the admin. Rechecked my group and it is a 1 – must hve been looking at another table or imagining things as been up all night trying to get this to work – and now the sun is coming up but if I can get it to show on the front then at least I can get some sleep ??

    Appreciate your help!

    I am install a cache plugin as I have not done that yet. Maybe that will fix it.

    Thread Starter ahau

    (@ahau)

    Hmm, good point about the cache – can you see the forums herehttps://whakapapa.maori.org.nz/? Then I know it will bew all of my cache verisons I have ??

    Thread Starter ahau

    (@ahau)

    Ok, Just realised I can not see all of the menuy – only Forums, Member, Moderation when I am logged in with GroupID 6. When Logged in with groupID 5 I can not see any of the forum admin and of course GroupID 1 I can not see any admin for anything as it should be.

    When I am loeed in and can see the forum admin in the back I can also see the forums in the front, but none of the other times.

    Thread Starter ahau

    (@ahau)

    magically appeared – don’t ask how!

    Thread Starter ahau

    (@ahau)

    Thank you for your reply.

    Yes, I am using wpForo.

    Not fully indexing into tables outside of the wp_posts table also explains why it will not index my plugins fully as they are are in seperate tables also.

    Once again thank you for your time – your reply is appreciated ??

    Thread Starter ahau

    (@ahau)

    Oh wow @bcworkz you rock! Thank you, thank you, thank you!!!! ?? I am sooo greatful and really appreciate all of your help!

    I liked your suggestion about translating back to mixed case as that makes it easier for me to read – and it matches the case in the tables. I have used the following and it works perfectly – not only for the Old news but for the other 4 plugins as well ??

    function wcon_shortcode_list($atts) {  // for atts put that in ($atts)
    	extract(shortcode_atts( array(
    		'newscatid' => ''      // hard code a number here all works
    		), $atts));
    		$NewsCatID = $newscatid;
    	global $wpdb;

    At least I will never make that mistake again, by having upper case in any atts function ?? But learning about ‘must have the lower case’ is good because if I have troubles with other code in my plugins that is something I will be able to check out in the function source code to see if I can solve it before I post if need be ??

    Waxing lyrical about human folibles was good as I learnt from that as well – don’t use text if calling atts as too much room for errors and numbers rule! *LOL*

    All in all this has been very valuble for me, not only because the code now works, but because I have learnt so much along the way.

    Once again, I really appreciate all of your time and efforts – thank you ??

    Thread Starter ahau

    (@ahau)

    Once again I appreciate your time and your reply – it does give me hope that I can get this to work ??

    I have made sure it is all single quote marks and I have checked and checked to make sure what strings I use are all in the right place and same case. NewsCatID is the correct name in the table and to make things easier I have now used that all the way thorugh so I do not confuse myself and anyone else ??

    If I put a number 2 in between the single quotes in 'NewsCatID' => '' it works perfectly using [old-news-items-list NewsCatID='2'] but as soon as I take that number out of the array and have it as it is below I get the message No Old News to Display

    I have made sure that I have a record in the table that has a NewsCatID 2 – even called the title This is NewsCatID 2 so I can see at a glance if I have the right records coming up ??

    Here is the code that I am using now

    add_shortcode( 'old-news-items-list', 'wcon_shortcode_list' );
    
    function wcon_shortcode_list($atts) {  
    		extract(shortcode_atts( array(
    		'NewsCatID' => ''      // hard code a number here all works
    		), $atts));
    	global $wpdb;
    
    $old_news_query = 'SELECT * from ' . $wpdb->get_blog_prefix();
    $old_news_query .= 'wcon_old_news WHERE NewsCatID = ' . $NewsCatID . ' ORDER by NewsID DESC';
    $old_news_items = $wpdb->get_results( $old_news_query, ARRAY_A );
    
    	// Prepare output to be returned to replace shortcode
    	$output = '';
    	$output .= '<div class="old-news-items-list">';
    
    	// Check if any old news were found
    	if ( $old_news_items ) {
    		// Create layout for the old news
    		foreach ( $old_news_items as $old_news_item ) {
    			$output .= '<b>' . $old_news_item['NewsCategory'] . '</b><br>';
    			$output .= '<b>' . $old_news_item['NewsTopic'] . '</b><br>';
    			$output .= nl2br($old_news_item['NewsBody']) . '<br>';
    			$output .= '<i>Posted By: ' . $old_news_item['NewsPoster'] . ' on '  . date('d/m/Y', strtotime($old_news_item['NewsDate'])) . '</i><hr>';
    			
    		}
    	} else {
    		// Message displayed if no news found
    		$output .= 'No Old News to Display';
    	}
    
    	$output .= '</div>';
    
    	// Return data prepared to replace shortcode on page/post
    	return $output;
    }

    It seems to me (remembering that I do not know what I am doing) is that the NewsCatID number in the shortcode page is not being put into the NewsCatID array bit to run the query so what am I missing?

    I have also tried all of the following shortcodes – hoping it was the quotes wrong, but no joy

    [old-news-items-list NewsCatID ='2']
    [old-news-items-list NewsCatID =''2'']
    [old-news-items-list NewsCatID ="2"]
    [old-news-items-list NewsCatID =2]

    I do have a plan b – probably not a good idea – but I could always do duplicates of this function, changing the names and having one per number hard coded in or without the atts but still one for each call – yeah I know – bad and not a good idea seeing as one of the plugins has 13 different options – but it may be my only option if I can not get this to work properly!

    Any help greatly appreciated ??

    Thread Starter ahau

    (@ahau)

    If anyone else has this problem and can not find the strange characters (as I could not) then this is what I found will strip them out even though you can not see them.

    Save your csv file as an excel file
    On the import page, you will see a link saying Use an online file converter
    Go there and upload your xcel file and convert to csv
    Download that csv
    Import it and you will be able to get all of the names in ??

    • This reply was modified 7 years, 3 months ago by ahau.
    Thread Starter ahau

    (@ahau)

    Perfect!

    I did find when I went to update a list that it adds everyone back in again, but all good because backups are my friend ??

    Once again thank you very much for your work and time with this – it is truely apprecieated ??

    Thread Starter ahau

    (@ahau)

    Quite happy to edit code @jeroenpeters1986 so let me know the files and what to change and I will do it ??

    Really appreciate that ??

    Thread Starter ahau

    (@ahau)

    Thank you so much @bcworkz for your reply – it is very much appreciated ??

    Since posting I have had a look at how other plugins do shortcode and saw alot use numbers. Then when I read your post, especially about human error I decided to go with numbers instead of text and it worked!

    But that is only if I hard code it in.

    How do I change the following so that if I use [old-news-items-list NewsCategory='2'] on a page it will pull up all of the records for that CatID? Or the lot if there is no CatID? I am picking I have to change the array code somehow?

    function wcon_shortcode_list($atts) {  // for atts put that in ($atts)
    		extract(shortcode_atts( array('CatID' => ''), $atts));
    	echo $CatID;
    	global $wpdb;
    
    	// Prepare query to retrieve old news from database
    	$old_news_query = 'SELECT * from ' . $wpdb->get_blog_prefix();
    	$old_news_query .= 'wcon_old_news WHERE CatID = ' . $CatID . ' ORDER by NewsID DESC';

    Wandering off topic, your information about slugs is invaluble and has made me re-think how I am doing things, but that is all good. I admit I ws being lazy with the Old News Cat thing, but now numbers are better so all of the categories have a CatID to pull up what I want.

    I’m doing 5 plugins for old data that I have. Some don’t have add / edit / delete as they are for archival puroposes only (relating to genealogy) and I don’t want 4000 posts with not much on them, hence the writing of these plugins. That way I can have alot of records on a page – and different pages for different categories when I get that to work *LOL*

    I have had a good look at other plugins and found some that will work well with other data sets that I hvae, but could not find anything comparable for these 5 data sets, hence the reason I decided to write my own.

    Once again, I really appreciate your reply ??

    • This reply was modified 7 years, 3 months ago by ahau.
Viewing 15 replies - 31 through 45 (of 60 total)