Blog Types

Noticed this was scheduled for release 3 days ago. Any word on when it’s actually coming ?

  • Ovidiu
    • Code Wrangler

    after implementing here: http://zice.ro I get an error with firebug:

    types_box is null

    http://zice.ro/

    Line 142

    types_box is null

    [Break on this error] var types_box_value = types_box.options[types_box.selectedIndex].value;

    If I click on it, it brings me here:

    140 function setup_subtypes_box() {

    141 var types_box = document.getElementById(‘blog_type’:wink:;

    142 var types_box_value = types_box.options[types_box.selectedIndex].value;

    AND as a bonus the tabber tabs on the frontpage disappear :slight_smile:

    I will leave this like this for today so you can check if its indeed this plugin causing trouble or not…

  • Klark
    • Site Builder, Child of Zeus

    I have a problem with the Blog Type setting not saving when trying to update a blog.

    Also please, please explain this a bit more. I just want to do something simple like displaying a list of Blog Types on the frontpage. Each type links to a page with a list of blogs under it. Also is it possible to show the number of blogs in a Blog Type category.

    To take it one stage further, you also now have the meta data (if you know what you’re doing… i.e. not for beginners, just yet) to create dynamic front pages which list users, posts, tags and other data associated with that grouping.

  • Andrew
    • Champion of Loops

    Hiya,

    should read: 3) Rename blog-types-config-sample.php to blog-types-config.php

    Fixed in the latest release.

    [Break on this error] var types_box_value = types_box.options[types_box.selectedIndex].value;

    A change in the latest release should take care of this issue.

    I have a problem with the Blog Type setting not saving when trying to update a blog.

    This bug is fixed in the latest release (2.0.1)

    Also please, please explain this a bit more. I just want to do something simple like displaying a list of Blog Types on the frontpage. Each type links to a page with a list of blogs under it.

    We’re working on a plugin that will provide a very similar feature. If you need it immediately though it wouldn’t be super complicated to code. All you need to do is grab a list of blogs from the db table.

    Also is it possible to show the number of blogs in a Blog Type category.

    All that is required is an incredibly simple query.

    Thanks,

    Andrew

  • Ovidiu
    • Code Wrangler

    unfortunately I stil got the break error :slight_frown:

    and it seems you haven’t updated the Version: 2.0.0 to Version: 2.0.1 or I am somehow getting a cached version of the plugin which would explain why the error still persists on zice.ro :slight_frown:

  • Klark
    • Site Builder, Child of Zeus

    We’re working on a plugin that will provide a very similar feature. If you need it immediately though it wouldn’t be super complicated to code. All you need to do is grab a list of blogs from the db table.

    Hey Andrew,

    Will this be a separate plugin all together or will it integrate with Blog Types ? Why not make it a feature of Blog Types like other plugins of this type have. Thanks.

    If you need it immediately though it wouldn’t be super complicated to code. All you need to do is grab a list of blogs from the db table.

    Unfortunately for me, coding isn’t my strong suit :slight_frown:

  • Andrew
    • Champion of Loops

    Will this be a separate plugin all together or will it integrate with Blog Types ?

    Completely separate plugin.

    Why not make it a feature of Blog Types like other plugins of this type have.

    Not everyone wants a blog directory. If there’s a plugin that would work better for your particular need then I’d definitely go with that one.

    Thanks,

    Andrew

  • Ovidiu
    • Code Wrangler

    @Andrew: I am getting the error straight on my frontpage.

    I just tested the signup page and I get it there as well, but only after advancing to the second page, meaning after I click the next button the first time. Then I see the screen where I actually select my blog title and the blog category but there is no error anymore.

    Just have a look: http://zice.ro and see what firebug is telling you.

  • Ovidiu
    • Code Wrangler

    k, solved.

    dunno what I did, but after I played around with the config file, and actually entered meaningful stuff tehre, disallowed choosing of subtypes it now works.

    wonder if the problem will appear again after re-enabling subtypes :slight_smile:

  • Klark
    • Site Builder, Child of Zeus

    Hey Andrew,

    All my problems fixed with new version. Thanks, great work. I using it to provide a selection of 30 countries and territories with no subtypes.

    Honestly I rather use this plugin rather than the other (which is a bit messy).

    For my other problem/request.

    I’m thinking I can:

    1. Insert a query directly into my theme to display a list of types on the frontpage (along with # of blogs under each type).

    2. Create 30 page templates, each with a query to return a list of blogs under each of my types.

    Is that the best way to approach this ? Can you give me a quick pointer on how to go about pulling a list of all types. And then pulling seperate lists for blogs under each type.

  • Andrew
    • Champion of Loops

    Hi,

    1. Insert a query directly into my theme to display a list of types on the frontpage (along with # of blogs under each type).

    Actually you don’t need to use a query to get the blog types. Just grab the array and loop through it. Something like this:

    foreach ($blog_types as $blog_type) {

    $blog_count = QUERY COUNTING BLOGS FOR BLOG TYPE

    echo $blog_type . ": " . $blog_count . "n";

    }

    2. Create 30 page templates, each with a query to return a list of blogs under each of my types.

    For that you just need to run a query grabbing a list of blogs for the blog type.

    Is that the best way to approach this ?

    Not sure about the ‘best’ but it would be the easiest code-wise.

    Can you give me a quick pointer on how to go about pulling a list of all types.

    Example above.

    And then pulling seperate lists for blogs under each type.

    That’s just a basic query. Look as some plugins for a count query.

    Thanks,

    Andrew

  • Klark
    • Site Builder, Child of Zeus

    This is what I got. The List of types is shown, but the count is 0 for each. What am i doing wrong ?

    <ul>
    <?php
    foreach ($blog_types as $blog_type) {
    $blog_count = $wpdb->get_var("SELECT COUNT(*) FROM " . $wpdb->base_prefix . "blog_types WHERE blog_types = '" . $blog_type . "'");
    echo '<li>' . $blog_type['name'] . " - " . $blog_count . "n" . '</li>';
    }
    ?>
    </ul>

  • Marko
    • Design Lord, Child of Thor

    Did anyone get list of types (or even subtypes) working? If so, can You please provide detailed explanation on how to do that and also URL where I can see that in action would also be helpful. What I want is a list of all types displayed on one page and if someone clicks on certain type he gets a list of all blogs from that category (type).

    Thanks,

    Marko

  • Andrew
    • Champion of Loops

    Hiya,

    Having special characters in the subtypes doesn’t work. Do you know how can I fix it ?

    The easiest way to fix this is to use the html code instead of the character in the Name and use basic characters in the Nicename.

    So basically “Voilà” should be:

    Name: Voilà

    Nicename: Voila

    Note that the Name is just what is displayed, it’s not actually stored anywhere. Sometimes you can get away with the special characters in the nicename. However, I usually convert them to basic characters anyway.

    Thanks,

    Andrew

  • Enseignement
    • Design Lord, Child of Thor

    Hello Andrew,

    I’ve of course tried this before but it did not work

    Name : Premiére

    I’ve tried Premiére and it displays Premi’ugly-white-square’re

    I’ve tried Premiére and it displays Premiére

    I guess it’s because of Javascript handling it ..

    I’ve used no special characters in nicename, but it’s the name that is displayed by the blog types plugin.

    What do you suggest ?

  • terence
    • Design Lord, Child of Thor

    This might be a dumb question but how do I find a list of all the blog types on my system? I’ve got it working but can’t find a sys admin button to access the data. Where is the data being stored and how do I access it? I guess I thought there would be a button in the site admin dashboard that says blog types and provide a list of them all for me. I am at a university and setting it up the blog types by faculty, students, and staff with the subcategories as colleges. My goal was to find out who is blogging and from what part of the university they are from. I also thought about displaying that data on the front page of our blog system. Thanks for the plugin and for your help with this question.

    ps. We are using the LDAP plugin and wondered if you knew of an easy way to integrate blog types with LDAP. Thanks.

    Terence

  • Ovidiu
    • Code Wrangler

    still got the issues I described on page one of this thread.

    I get an error with firebug:

    types_box is null

    http://zice.ro/

    Line 142

    types_box is null

    [Break on this error] var types_box_value = types_box.options[types_box.selectedIndex].value;

    If I click on it, it brings me here:

    140 function setup_subtypes_box() {

    141 var types_box = document.getElementById(‘blog_type’:wink:;

    142 var types_box_value = types_box.options[types_box.selectedIndex].value;

    AND as a bonus the tabber tabs on the frontpage disappear :slight_smile:

    I will leave this like this for today so you can check if its indeed this plugin causing trouble or not…

    here is my configuration file, do you see anything fishy? http://pastebin.com/m20e71479

    ###edit###

    as soon as I disallow subtypes all works again :slight_frown: but I’d really like to use subtypes.

    // Enable subtypes

    $blog_types_enable_subtypes = ‘no’; //Options: ‘yes’ or ‘no’

  • Andrew
    • Champion of Loops

    Hiya,

    It’s not a problem with your configuration. The problem is with the JS. Due to this problem and the probably some people are having with accents I’m problem just going to remove the subtypes feature from the version available here.

    That feature wasn’t thoroughly tested and I actually left it in by accident.

    Thanks,

    Andrew

  • Enseignement
    • Design Lord, Child of Thor

    Hello,

    Anyone ..?

    Did anyone get list of types (or even subtypes) working? If so, can You please provide detailed explanation on how to do that and also URL where I can see that in action would also be helpful. What I want is a list of all types displayed on one page and if someone clicks on certain type he gets a list of all blogs from that category (type).

  • drmike
    • DEV MAN’s Mascot

    god consideration

    I don’t think she’s a wp user to be honest. :smiley:

    First thing I would look at is what datatype the database is. With all due respect to Andrew and crew, having database tables something other than UTF8 is a reoccurring issue. My money, with the understanding that I’ve not looked at this plugin, is that the database is in something other than UTF8.

    No disrespect intended of course.

  • Hiranthi
    • Recruit

    Don’t know if anyone else noticed this, but <SCRIPT language="JavaScript"> gives me 2 errors with w3c (blog type is putting that in the head of the theme).. It should be <script type="text/javascript"> (with the ending tag </script> also in lowercase, ofcourse).

  • Hiranthi
    • Recruit

    Well, the fact is that it’s breaking the main blog’s html. Don’t know about client-blogs, seeing I haven’t gotten any yet (project is still in dev-stage). So, I already fixed it, just thought I’d mention it here too.

    I find it very important that my websites are w3c compliant, so I don’t want clients to point to me that my code doesn’t validate (whether it has been generated by a plugin or not). And imo that’s a better service to your clients (having it fixed already, instead of waiting until someone else points it out and then fix it).

  • drmike
    • DEV MAN’s Mascot

    I don’t want clients to point to me that my code doesn’t validate

    Honest answer: considering that there are some folks out there who see the standards in a different light than how others see it, you’re going to have someone point something out when it comes to validation. I’d have to go digging for it but I recall a couple years back this discussion over RSS and how wordpress kicks it out. The problem? A single capital letter within the tag. One validation site said it had to be capitalized, the other said it had to be lower case. Lots of fun.

    Also even if you promote yourself as having valid code and all that, you;re still going to have folks go on and on in your support forum explaining how you need to have it and how important it is. Had a couple of those in wp.com land.

    *shrug* I agree that you need valid code. I also think you need to actually show your clients that you’re going to take care of them.

  • terence
    • Design Lord, Child of Thor

    Hello,

    I know this question has been addressed, but I am still foggy on the solution. How can I get the blog topics information to display on a blog?

    nizouille said to add this code


    $blog_subtypes[1] = ‘Première ann”é”e’;


    But I don’t know where to put that code to display the information.

    Also Andrew said to grab the array and loop it through like the following


    foreach ($blog_types as $blog_type) {

    $blog_count = QUERY COUNTING BLOGS FOR BLOG TYPE

    echo $blog_type . “: ” . $blog_count . “n”;

    }


    But again, I don’t know what file to add that code too, to get it to display (ie. home.php? sidebar.php? index.php? a template file? a core file? etc)

    Thanks and sorry for the novice question.

    Terence

  • terence
    • Design Lord, Child of Thor

    @Andrew

    Thanks. My goal would be to create a unique blog for each main topic. Therefore, one could go to the Topic blog and see all the blogs from that topic displayed on the main page as well as use the search engine to search for specific blogs within the Topic. The sidebar would display the subcategories of the main topic. For example, if the School of Art is the main topic and the subcategories are Faculty, Staff, and Students one would see a list of all the blogs on the main page and the subcategories (faculty, staff, students) on the sidebar.

    ps. It seems that it might work nicely with Doncha’s Sitewide Tags plugin where one could pull in Blog Topics. Just a thought.

    Thanks for you time,

    Terence

  • nferrari
    • New Recruit

    Hi, just installed the plug-in on my WPMU instance but I didn’t get how to display the list of types on my theme. I included this code on my custom theme :

    <?php

    print $blog_types;

    foreach ($blog_types as $blog_type) {

    echo $blog_type . “n”;

    }

    ?>

    Error displayed : Warning: Invalid argument supplied for foreach() in /../wordpress-mu/wp-content/themes/mytheme/footer.php on line 14

    Thanks for any help !

  • nferrari
    • New Recruit

    ok new question : the table ‘blog_types’ is empty after updating the types in administration. So this line return 0 :

    $blog_count = $wpdb->get_var(“SELECT COUNT(*) FROM ” . $wpdb->base_prefix . “blog_types WHERE blog_types = ‘” . $blog_type . “‘”:wink:;

    When does the INSERT query execute ? What could be the reason why it’s empty ? Updating the blog types in administration just fill the table “options” of the current blog.

    Thanx for any help !

  • nferrari
    • New Recruit

    ok sorry again the table where not empty BUT while using multiple types for a blog, change the request like that :

    $blog_count = $wpdb->get_var(“SELECT COUNT(*) FROM ” . $wpdb->base_prefix . “blog_types WHERE blog_types LIKE ‘%” . $blog_type . “%'”:wink:;

  • lk2009
    • New Recruit

    Hi all,

    I’m wanting to use the Blog Types to automatically show a list of blogs for a particular blog subtopic.

    For example, I want to create a page on the main wpmu site called Cairns – and then have all blogs listed on that page that have signed up under the “Cairns” blog subtopic.

    I am needing to have the list of individual blogs show their Title only (that they put in at sign up) and have that linked to go to the blog domain.

    Can anyone help me with the php code I need to make this happen? I’ve a basic level understanding of php, but trying to make the right code in this case is beyond me – much appreciated if anyone can help.

  • lk2009
    • New Recruit

    Sorry, I meant sub blog types not topics above…

    Really needing help with this:

    I’m wanting to use the Blog Types to automatically show a list of blogs for a particular blog subtopic. (correction – blog subtype)

    For example, I want to create a page on the main wpmu site called Cairns – and then have all blogs listed on that page that have signed up under the “Cairns” blog subtopic. (correction – blog subtype)

    I am needing to have the list of individual blogs show their Title only (that they put in at sign up) and have that linked to go to the blog domain.

    Can anyone help me with the php code I need to make this happen? I’ve a basic level understanding of php, but trying to make the right code in this case is beyond me – much appreciated if anyone can help.

  • Andrew
    • Champion of Loops

    Hiya,

    Something like this should do the trick:

    $query = "SELECT * FROM " . $wpdb->base_prefix . "blog_types WHERE blog_subtypes LIKE '%|cairns|%'";
    $blogs = $wpdb->get_results( $query, ARRAY_A );
    if (count($blogs > 0){
    echo '<ul>';
    foreach ($blogs as $blog){
    $siteurl = get_blog_option( $blog['blog_ID'], 'siteurl' );
    $title = get_blog_option( $blog['blog_ID'], 'blogname' );
    echo '<li>';
    echo '<a href="' . $siteurl . '">' . $title . '</a>';
    echo '</li>';
    }
    echo '</ul>';
    }

    You’ll need to toss that into a page template. If you don’t know how to do that then hit Google or the Codex.

    ‘cairns’ should be your nicename for ‘Cairns’. If it’s not then update the code accordingly.

    I don’t currently have a test install running the blog types plugin so I haven’t tested this. However, it should at least point you in the right direction.

    Thanks,

    Andrew

  • lk2009
    • New Recruit

    You’re a lifesaver Andrew – that did the trick.

    Initially I got a few errors so I changed from this

    if (count($blogs > 0)(

    to this:

    if (count($blogs > 0))

    and removed } from the line before the last echo '';

    I hope it’s ok that I do that – it seems to work ok?

    Anyway, shows exactly what I need i.e. a list of titles of the blogs for a blog subtype which when clicked on takes you to that blog front page.

    Much appreciated.

  • Andrew
    • Champion of Loops

    Oops, that was definitely a typo. Here’s a proper fix:

    $query = "SELECT * FROM " . $wpdb->base_prefix . "blog_types WHERE blog_subtypes LIKE '%|cairns|%'";
    $blogs = $wpdb->get_results( $query, ARRAY_A );
    if (count($blogs) > 0){
    echo '<ul>';
    foreach ($blogs as $blog){
    $siteurl = get_blog_option( $blog['blog_ID'], 'siteurl' );
    $title = get_blog_option( $blog['blog_ID'], 'blogname' );
    echo '<li>';
    echo '<a href="' . $siteurl . '">' . $title . '</a>';
    echo '</li>';
    }
    echo '</ul>';
    }

  • Enseignement
    • Design Lord, Child of Thor

    Hello,

    Could anyone put an example and the code used to display the list of types and the appropriate list of blogs …

    It seems that some people have worked that missing feature in the plugin here, but I don’t know what to add exactly in my theme to display that.

    Thanks a lot for your help !!

    Benjamin

  • TonyRLAt
    • WPMU DEV Initiate

    Hi all,

    First, since I’m brand new here, let me say how fantastic this community is and how much I appreciate all you all do to help others, whether premium payers like me or public.

    Anyway, here’s my first question (please expect more):

    How can I limit the length of a user’s post? I would like to be able to limit them by either number of characters or number of words. This has to do with things like writing contests or twitter games. I’ve been scrounging around the usual locations and haven’t yet found anything.

    Thanks again!

  • Peace
    • New Recruit

    Hi

    how to show the "blog tybes" in my front page

    i am put "blog-types.php" into "wp-content/mu-plugins/"

    and

    "blog-types-config.php" into "wp-content/"

    but i not found widget

    and not found code to add in my theme

    Thanks,

  • Enseignement
    • Design Lord, Child of Thor

    Hi,

    I’m close to a final working solution, that I’ll be happy to share with anyone interested. The only thing that is not working is passing the blog_subtype argument.

    $selected_blog_subtype = $_POST’];

    Could any WPMU Expert help here ? Pleaaase :slight_smile:

    <form method="post" action="http://blog.enseignons.be/blogs-pedagogiques/">

    <label for="blog_types">Niveau :</label><select name="blog_type" id="blog_type" onchange="update_subtypes_box()" style="text-align: left; font-size: 20px;">

    <?php

    global $blog_types;

    foreach ($blog_types as $blog_type) {

    echo '<option value="';

    echo $blog_type.'';

    echo '">Niveau ';

    echo $blog_type.'';

    echo'</option>';

    }

    ?> </select>
    <label for="blog_subtypes">Type de blog:</label><select name="blog_subtypes[]" id="blog_subtypes[]" style="text-align: left; font-size: 20px;" size="4">

    <?php

    echo '</select><input type="submit" name="envoi" value="OK"></form>';

    ?>

    <?php

    $selected_blog_type = $_POST;

    $selected_blog_subtype = $_POST'];

    echo $selected_blog_type;

    echo $selected_subblog_type;

    echo '<h2> Blogs de la catégorie '.$selected_blog_subtype.' </h2>';

    $query = "SELECT * FROM " . $wpdb->base_prefix . "blog_types WHERE blog_subtypes LIKE '%|" .$selected_blog_subtype."|%'"; $blogs = $wpdb->get_results( $query, ARRAY_A ); if (count($blogs) > 0){ echo '

      '; foreach ($blogs as $blog){ $siteurl = get_blog_option( $blog, 'siteurl' ); $title = get_blog_option( $blog, 'blogname' ); echo '

    • '; echo '' . $title . ''; echo '
    • '; } echo '

    '; }

    ?>

  • Andrew
    • Champion of Loops

    Could any WPMU Expert help here ? Pleaaase :slight_smile:

    I’m afraid we’re a bit short on time this week so assistance is really going to be limited to fixing plugin bugs.

    Hopefully another member with some free time can lend you a hand.

    Thanks,

    Andrew

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.