This forum is for module development and code related questions, not general module support. For general support, use the Post installation forum.

Two nodes of different types from the same form. Is it even possible?

The case:
I'm making a new node type called 'business', so that business owners can register their business with my catalog.
I want the business owners to be able to add their logo to the node, or use a previously added logo (for store chains etc).
I want each logo to be an image type node.

This is no problem:
I've figured out how to list images filtered by a taxonomy term / image-gallery and use it in a form.

The problems:
The problems starts when a new logo is to be added.
I want this to be as simple as possible for non techy store owners to use, with a minimal chance of messing things up.
So far I've come up with two ideas, but I have not been able to figure out how to code any of them.

Suggestion 1:
Is it possible for me to somehow create two nodes of different types from the same form? i.e. create a new image node under a given taxonomy term with the data from the business node form.
I'm struggling to figure out what function (probably one in node.module) to call to bypass the node creation form in the image module. What I would like to do is to call some create_node($type, $form_fields, $terms) function. Does one excist?, or maybe I can call several functions to accomplish this.
It should be possible to automate the node_creation process like syscrusher has done in his image_import module, (http://drupal.org/project/image_import). Sadly it escapes me how it is done, I got lost somewhere in all the debug functions still in there.

Drupal.org-style Code Quoting

What module (or filter) does Drupal.org use to support inline display of HTML and PHP code in forum posts (or any post for that matter?) I'd like to add similar functionality to my Drupal site, but haven't been able to track down what enables this.

Apply node filters without calling node_view ... any ideas?

With the CCK maturing and Views the best thing since sliced bread, drupal is becoming, among many other things, an incredible backend for flash only projects.

I have created a "flashapi.module" that I use to expose just a few functions via xmlrpc that cover most of everything I need in flash, like:

flashapi_get_node(nid) - returns a node object
flashapi_get_view(view_name) - returns an array of node objects in a view (simply amazing)
flashapi_send_contact_email(name, email, subject, message, etc.) - sends an email
...

Here is the code for flashapi_get_view()


function flashapi_get_view ($appkey, $view_name)
{
  $app = flashapi_validate_app($appkey);
  if($app !== true) {
    return flashapi_error($app);
  }
  
  $view = views_get_view($view_name);
  if ($view == null)
  {
    return flashapi_error('View does not exist.');
  }
  
  $result = views_build_view('result', $view);
  while ($node = db_fetch_object($result['result'])) {
    $nodes[] = flashapi_node_format(node_load($node));
  }
  
  return $nodes;
}

Right now, when returning a node object, the object does not have any filters applied to it.

My question is:
How can I return a node object via flashapi_get_node or a list of nodes via flashapi_get_view, with filters applied?

I can't just run node_prepare() on the node, or check_markup() on the desired fields, becuase I will also need to trigger the hooks in CCK to filter the custom fields there.

Extending capabilities ...

I've read lot of hooks, but i'm not shure top understand well.

The problem
I need to perfome some more task upon a special event ...
I want that when ... a user change language --> the system could update a series of information based on that parameter ...

for example ...

Create a story node

I'm developing a new module which, among other things, carries out a some updates as part of the cron hook. For the last part of the cron hook, I want to create a new 'story' node which will appear on my front page and let the users know that the updates are complete.

It only happens once a week at most, so I don't care that each one will contain the same or similar text.

What is the best way of creating this new node?

Cheers,
Ian

Communication error: when using paypal with ecommerce

I setup paypal and ecomerce package on my site for selling some non-shippable goods. I setup the paypal account and put its cert_key_pem.txt file at /home/abc/cert/cert_key_pem.txt . The website is located at /home/abc/public_html/ folder. I put the correct api information received from paypal.com at admin/settings/paypalpro. But trying to purchase something it gives error:

Communication error. Failed to connect to the authentication server. Please try again later.
(libcurl error #35: SSL: error:14094418:SSL routines:func(148):reason(1048))

Pages

Subscribe with RSS Subscribe to RSS - Module development and code questions