[drupal-devel] [feature] blogapi--Allow posting to multiple node types

walkah drupal-devel at drupal.org
Mon Jan 31 18:31:06 UTC 2005

 Project:      Drupal
 Version:      cvs
 Component:    blogapi.module
 Category:     feature requests
 Priority:     normal
 Assigned to:  walkah
 Reported by:  nedjo
 Updated by:   walkah
 Status:       patch
 Attachment:   http://drupal.org/files/issues/blogapi-multiple-types2.diff (7.19 KB)

here's an updated patch that allows administers to control which node
types can be posted via blogapi (as per nedjo's suggestion). also i've
added some documentation about the 'unusual' usage. 
please apply for 4.6 :)


Previous comments:

March 3, 2004 - 15:43 : nedjo

Attachment: http://drupal.org/files/issues/0202.HEAD.nedjo.blogapi_module.patch (2.35 KB)

The attached patch adds a setting to the blogapi allowing site admins to
choose the node type that blogapi entries will go to.  This will be
useful when wishing to do regular story (as opposed to blog-type) entry
posting through the api.
questions to Nedjo Rogers nedjo at gworks.ca


March 17, 2004 - 22:47 : moshe weitzman

I'd like this functionality too. But this patch may cause moe harm than
good. If user chooses story or blog, the patch works. If he chooses
book, or recipe or poll, etc., he will get a validation error. Thes
node types require more information.


March 22, 2004 - 15:07 : nedjo

Attachment: http://drupal.org/files/issues/0202.HEAD.nedjo.blogapi_module_0.patch (2.32 KB)

Thanks for noting this; I'd failed to test with other node types.  I've
modified the patch to limit the choice to either "story" or "blog".


August 12, 2004 - 10:20 : killes at www.drop.org

Doesn't apply anymore.


August 14, 2004 - 22:04 : nedjo

Attachment: http://drupal.org/files/issues/blogapi.allow-choice-of-node-type.patch (3.75 KB)

Here is an updated patch.  Now enables three choices: blog, page, and


August 21, 2004 - 12:12 : Dries

I'm not going to commit this unless there is more demand for it.


August 21, 2004 - 13:56 : nedjo

This functionality has been requested here [1] (/Posts made by w.Bloggar
seem to be an entry other than "Story," which is what I want. I don't
see any way to make w.Blogger post to this node type./) and here [2]
(/they automatically post "personal blog entry" node types, I'd want
them to post "story" nodes/).
My judgement is that blogapi could readily be used considerably beyond
the limited blog application.  This small change would make the highly
developed blogapi into a tool for general site posting rather than
restricting it to what is, for many sites, a little-used medium, the
[1] http://drupal.org/node/view/8055
[2] http://drupal.org/node/view/9852


October 18, 2004 - 01:15 : Anonymous

Here's another vote for extending the blogapi to allow posting stories
and other node types!
This would be a great addition.


October 18, 2004 - 06:46 : Robert Castelo

This would be really useful for Drupal sites I've set up for companies -
where employees enter content into a taxonomy created by me and the
(client) project manager.
Most employees will be able to use a point and click desktop
application much better than a Webpage interface with clunky Javascript
controls (none of them know HTML). 
Extending the blogapi to other node types would add considerable value
to Drupal for business use.


October 18, 2004 - 07:16 : moshe weitzman

+1 for the functionality. but there is a problem with the patch. it hard
codes permission names from 3 different modules. instead, use
node_access('create', $type). that fragment was taken from the end of


November 26, 2004 - 10:48 : teradome

An idea:
Since blogid is a string identifier according to the APIs, why not
allow node types to be selected by using the name of the node type
You could keep the checkbox list of available nodes in the blogapi
settings page (blog option on by default), which would also list what
blogid string you need to enter in your remote client to access it.
This way you can add them in incrementally. Legacy support via the
user's system # could be maintained, but "blog" as a blogid would
become the preferred way of "editing own blog." (Obviously, you can't
do more than your own, given the simplicity of the APIs.)
Even more hardcore would be to implement this into a hook, so other
modules could add blogapi support (I'm thinking "quotes" for one).
Since you would identify by the node type, there's no overlap.


November 26, 2004 - 11:06 : walkah

teradome : excellent idea! i like this approach... and it should work
well within the (limited) framework of the apis... the only thing is
that several editors present this as a list of your "blogs" which may
make it a bit confusing. however, it would cram this much desired
functionality into the existing framework.
let me play with it for a bit, and i'll prepare a patch.


November 26, 2004 - 11:41 : garym at teledyn.com

+1 from me on this one, although my own needs need a more generic
REST/webservices interface way beyond bloggerAPI.  I'd love to see
micro-content publishing gateways such that we could seamlessly post
complex items to the site, for example, posting member calendar
information directly from a cellphone into the events.module or a
Firefox XPI that exports/merges personal bookmarks files into the


November 26, 2004 - 12:11 : FactoryJoe at civicspacelabs.org

+1 on this patch (or the functionality at least). Right now, MarsEdit
[3] can't use Drupal categories because of limitations in the XML-RPC
API (according to brent @ ranchero.com). It sounds like this kind of
general change would enable me to use MarsEdit (or any other blog
editor )to its fullest potentional.
Oh, and excuse any technical errors with my assessment... I only
half-way know what I'm talking about. :1
[3] http://ranchero.com/marsedit/


November 26, 2004 - 15:07 : mike3k

I really want to see this feature. I have two story based Drupal sites
and I'd like to be able to post from MarsEdit. I like the suggestion of
using 'story' or 'node' as blog ID.


November 26, 2004 - 22:25 : nedjo

Attachment: http://drupal.org/files/issues/blogapi-allow-choice-of-node-type.patch (3.55 KB)

Here is an updated patch partially addressing Moshe's suggestion to
remove hard-coded module references.  I've left in hard-coded
references in the "edit own..." instance because the word needed is
different from the module name (e.g., "stories" for the story module).
"why not allow node types to be selected by using the name of the node
type itself?
I don't fully understand the suggestion of using the node type as an
id.  The id is set (I'm thinking) by the server--but the client has to
first make the posting.  How would a client select which type to
"Right now, MarsEdit can't use Drupal categories because of limitations
in the XML-RPC API (according to brent @ ranchero.com). It sounds like
this kind of general change would enable me to use MarsEdit (or any
other blog editor )to its fullest potentional.
This patch won't I think do anything to address that issue.  The new
release candidate of w.bloggar also seems to fail to set categories
(when used in Movable Type mode).  Likely we need to update the
handling of category requests.


November 29, 2004 - 09:16 : Anonymous

I'm a MarsEdit user and would love to use it with Drupal. The XML/RPC
features need to have more visibility, there are many who *would* use
them if they would know they exist and how they work.


November 29, 2004 - 15:01 : walkah

Attachment: http://drupal.org/files/issues/blogapi-multiple-types.diff (3.99 KB)

here's a patch that implements multiple node types using the (admittedly
very clever) blogid hack.
basically, you will appear to have "separate blogs" for each node type
that you can post to.
(yes moshe, posting will fail for recipies and events, etc)
you can maintain different taxonomy vocabularies for each node type -
which will work.
For those having trouble with MarsEdit : try setting the "Software" to
movabletype... it works for me with 1.0b12 . Brent has an old profile
for drupal in there it seems - back when we only did blogger api.
Please give this patch a try and offer feedback. 
thanks :)


November 29, 2004 - 19:26 : nedjo

Thanks for the patch.  I am mystified by it, but this may just reflect
my ignorance.  Could you explain how to use this from the client end
(e.g., using w.bloggar).  How/where does one indicate that a particular
post is e.g. a "story"?  Does this patch accomplish the primary desired
aim of this issue--enabling the use of blogapi by sites that don't use


November 30, 2004 - 08:48 : walkah

nedjo: essentially this patch follows teradome's suggestion to make use
of the formerly unused 'blogid' parameter that exists as part of the
APIs - specifically using that parameter to specify the node type to
create. how *exactly* this is used on the client side is dependent on
how the client handles the fact that the API allows for multiple blogs
per user account. i don't have access to a windows machine at the
moment, so I can't tell you specifically for w.bloggar, but i'll give
you two examples from the mac world:
attached to this issue is a screenshot of ecto
(http://ecto.kung-foo.tv/) which is my preferred app. as you can see on
my "local test" account i have 3 "blogs" - blog,page and story. thus
posting to the "story" blog creates a new story.
marsedit (http://ranchero.com/marsedit) does not automatically list all
blogs for a user account, rather you must specify a single blog id for
each account. so, you'd enter "blog" (for example)... where as that
previously defaulted to your userid  (and was unused).
does that make sense?


November 30, 2004 - 11:24 : walkah

Attachment: http://drupal.org/files/issues/ecto-blog-types.jpg (48.3 KB)

screenshot of how this patch looks in ecto attached for real this time


November 30, 2004 - 12:06 : nedjo

Thanks for the explanation, I get it now.  This approach has the clear
advantage (over what I'd suggested) of enabling a user to select from
various node types rather than a single server-designated one.  But it
depends on settings on the client.  This means extra instructions to
users, instructions that will vary by the client.  More importantly,
some clients won't support this functionality.  For example, I don't
find a way to specify multiple blogs per user with w.bloggar (a
commonly used client for Windows users).  So, while this is in my view
definitely an improvement on the existing module, it doesn't fully meet
the identified need.
I would therefore like to see this patch in combination with the
changes I suggested.  I.e., user can select which node type to post to
(as per walkah patch), admin can set default type if no type designated
by user (my patch).  That way there is advanced functionality for
clients that support it and a default solution for clients that don't.
Also, likely we should have an admin setting to limit the list
generated by function _blogapi_get_node_types() to designated types.  I
hard-coded this to "blog", "page", and "story", but we could instead
have a multiple select.


November 30, 2004 - 13:32 : Boris Mann

If you can't specify multiple blogs per user, the client is broken.
Seriously -- it means it won't work with Blogger or Blogware, to name
two I know of right of the bat that support multiple blogs per user.
Reading through w.bloggar's site, it does support multiple blogs for
Blogger. If someone on Windows could verify that it also works with
James' patch, I think we're done.
As walkah recently posted on his blog, we need to try and get better
APIs, rather than continually kloodging on both the client and server
side because of the limitation of the API.


November 30, 2004 - 14:04 : nedjo

Okay, I agree, this fully meets the need, apologies for my slowness,
it's just taking me a bit to catch on.  The only change needed to the
patch I believe is to edit _blogapi_get_node_types() so that it will
generate a limited list of node types (only those that blogapi will
work with) so that users won't get errors.  This could be hard-coded to
"blog", "page", and "story" or could be a multi-select (a new setting)
set by site admins.  E.g., to blogapi_settings, add something like (I
haven't tested this):

foreach (node_list() as $type) {
    $node_types[$type] = node_invoke($type, 'node_name');
    if (in_array($type, array('blog', 'page', 'story')) {
      $defaults[] = $type;
  $output .= form_select(t('Blog types'), "blogapi_node_types",
variable_get('blogapi_node_types', $defaults), $node_types, t('Select
the content types for which you wish to enable blogging.'), 0, 1);

and change _blogapi_get_node_types() to:

function _blogapi_get_node_types() {
  global $user;
  $approved_types = variable_get('blogapi_node_types', array('blog',
'page', 'story'));
  $types = array();
  foreach (node_list() as $type) {
    if (node_access('create', $type) && in_array($type,
$approved_types)) {
      $types[] = $type;
  return $types;


November 30, 2004 - 14:56 : Dries

... and document this peculiar usage in the help/documenation?


January 13, 2005 - 12:40 : teradome

man, i can't believe i'm just seeing this patch now... the tracker
really needs an option to follow "issues" that you've replied to!


January 13, 2005 - 12:59 : teradome

This. is. sweet. And just in time for my new workflow changes (blog=no
comments, forum=comments desired)!  Thank  you walkah!

View: http://drupal.org/node/6195
Edit: http://drupal.org/project/comments/add/6195

More information about the drupal-devel mailing list