Using custom URL.

Created a custom node type - "Microblog" - with normal title and body fields. Post is set to default published but not promoted to front page.

Posted a note from ping.fm

The note text is in the body but:

1) Post has no title.
2) Post was promoted to front page.

The title - not sure what to suggest here - any thoughts? I know I can't edit the post without assigning one.

The promotion - it would be better if the node type settings were used for the node type assigned.

Comments

chrissearle’s picture

Hmm. Something else about the creation means that things like Taxonomy Defaults (sets up a default allocation of terms based on node type) are not being applied either.

chuck1975’s picture

Assigned: Unassigned » chuck1975
StatusFileSize
new2.66 KB

I was able to fix the no title problem, but I had to add code to the pingfm.module.

Ping.fm will only pass a title if the service supports which is only "blog"... I wanted to be able to pass status messages to my site with a default title. So I changed the following in pingfm.module at line 193

        /**
         * added by chuck to fix the lack of title.  Should only change title if no title is provided.
         */
        if (is_Null($title)) {
          $title = "ping.fm update for " . $user->name; 
        }
        $node = array(
          'title' => $title,
          'uid' => $user->uid,
          'name' => $user->name,
          'body' => $message,
          'type' => $user->pingfm_customurl_nodetype,
          'promote' => 1,
        );

I also attached my updated pingfm.module file.

chrissearle’s picture

Something like this would work for me too (since I don't want to show the title itself - I just want it in a block view showing the contents). I just got irritated that I had to manually assign a title on edit each time.

However - for me the big issue is things like post promotion - you can see it in your code there - 'promote' => 1, - this ignores the setting on the content type. It should be just a case of retrieving the info (or at least that's the short fix - I have not looked at how nodes are created programatically so that other modules (taxonomy_default for example) get a chance - not sure if its here or elsewhere that would have to be looked at.

If I get a chance I'll look at this myself - but right now I'm in the middle of a difficult 5.x to 6.x upgrade for someone else (and of course - xmas is getting closer ... ;))

robloach’s picture

What if we just got the first 50ish characters of the node teaser if the title isn't there?

chuck1975’s picture

StatusFileSize
new2.93 KB

Because I am currently snowed in... I have continued to poke around with this module. Did a few more updates. I guess now I need to figure out how to submit back to the project... All though I am sure the code is not good, but it does work.

* User can configure the default title and use "!user" variable in the title
* Default title is only used if no title is passed from ping.fm
* User can set the promote option to on or off

I am working now on trying to allow the admin to override these user settings and force the promote on or off, and force the title format.

*update pingfm.module is attached.

chuck1975’s picture

Assigned: chuck1975 » Unassigned

Would be a good option if some one is using ping.fm to submit a full blog entry or a large microblog. However the smaller status messages that can come from ping.fm are often smaller than 50ish...

With that said, it could be one of the options. Such as "Use first X chars if body is more than X characters"? not sure...

Chuck

chrissearle’s picture

StatusFileSize
new1.14 KB

OK - not looked at the title - since there are at least two suggestions here - but the attached patch will take the promote setting of the node type that the user has selected. I felt that it was better to fetch the option from the node type rather than have a new custom option to set.

chuck1975’s picture

StatusFileSize
new601 bytes
new2.87 KB

Attached are two patch files that cover all the changes that have been made including from chrissearle to default the promote option to the nodetype properties.

Updates:
* All user to set the default title format
+ can use "!user" as replacement text
* Admin option to allow user to override nodetype promote setting
* User option to force promote (only viewable if admin allows)
* defaults promote to nodetype settings unless admin allows override and user has set the override.

I ran through several tests but with out any problems... but I am sure there is something I didn't think of.

robloach’s picture

Status: Active » Needs work

Hi Chuck. Nicely done with the patch! Thanks for having a look at this. There are a couple things I'd love tweaked before this goes in:

  1. "User override promote" doesn't really sound very descriptive. Would "Allow posting to front page". "When enabled, will allow users to send posts made with Ping.fm to the front page."... Does that make more sense?
  2. We don't need the authoring code comments in there. The CVS commit messages credit you ;-) .
  3. Could we use "is_null" instead? We want to stick with the Drupal coding standards ;-) .
  4. Instead of checking if ( variable_get('pingfm_prom_ovr', FALSE) == TRUE ) in the user options, you could just use '#access' => variable_get('pingfm_prom_ovr', FALSE) :-)... YAY Drupal!

Awesome work, Chuck! This is looking pretty slick. Once those changes are in, I think it should be commit ready. :-) Keep it up!

chuck1975’s picture

Thanks Rob... I will make the changes tonight and update.

chuck1975’s picture

Hey Rob,

quick question on number 3...

3) Could we use "is_null" instead? ....
- What did you want to replace with the is_Null? would it be instead of isset?
* sorry if this is an obvious question, new to coding with Drupal. :-)

1 - changed the wording to your suggestion. This does make more sense

2 - comments removed.

4 - OK... that is so much cleaner. Yay Drupal indeed!

Thanks, Chuck

chrissearle’s picture

Just tested the new patches. Applied cleanly and worked for me :D

If I could have one more thing (greedy of me - I know) then it would be the ability to have !teaser (or other appropriate named replacement) in the User account setting for title for a custom URL post where the title is missing.

This would function the same as "ping.fm for !user" but would be the first n chars of the body - or perhaps even better - the longest number of words (space used as delimiter) that do not go over n chars in length.

Looking at my own posts - n=50 would be good - this could be configurable - but would that be overkill?

One other comment - something I found really useful when I started writing patches for modules was coder module. If you install it then go to modules page in admin you get a link that does a drupal coding standards review for you. I found it really helpful so I thought I should recommend it ;)

blueskiwi’s picture

if I download the current dev version do I need to apply these patches being discussed here, or they've been rolled in?

chuck1975’s picture

They have not been rolled in as of yet. So if you need the extended features and small fixes, then you should apply the patch.

kapow99504’s picture

I like what you did here but when I look at the module's code it looks like it has changed since you made these fixes, have you updated the patch for the new module version?

Steven Brown’s picture

Assigned: Unassigned » Steven Brown

Using custom URL from Ping.fm capability will be updated with the following.

1. We will check the content type's default settings to determine if the node being created needs to be published or have comments on the node.
2. If there isn't a title passed we will generate one from the body text or the suggestion from #5.

Steven Brown’s picture

Status: Needs work » Closed (fixed)

Due to this issue being around 3 years old I'm changing the status to closed.