Show a popup after saving a new node How do I create a popup which can use the node variables after saving a new node?
For example, I want to show a popup with the social media share button. Should I use node_save()?
When a node is saved, the user is normally redirected to the page showing the node, which is not a form. In that case, hook_form_alter() doesn't help. I said the user is normally redirected to the page showing the node, as that is what Drupal does, but there could be a module that redirects the user to a different page, such as the one showing the node edit form to add a new node.

To show the popup when the node is viewed, you can use hook_node_view(), which can be used to add HTML tags to the node view page.

The example shown in the documentations shows how to add markup to the node view page.

function mymodule_node_view($node, $view_mode, $langcode) {
  $additional_markup = 'Markup to add to the page';

  $node-&gt;content['my_additional_markup'] = array(
    '#markup' =&gt; $additional_markup, 
    '#weight' =&gt; 10, 
  );
}


As for showing the popup right after the node has been saved, you could implement hook_form_alter() to add a form submission handler to the "Save" button; that submission handler would add a session variable that is the checked from your implementation of hook_node_view(). Its code should then be similar to the following one.

function mymodule_node_view($node, $view_mode, $langcode) {
  if (isset($_SESSION['nid']) &amp;&amp; isset($_SESSION['timestamp']) &amp;&amp; $_SESSION['nid'] == $node-&gt;nid &amp;&amp; mymodule_check_timestamp($_SESSION['timestamp'])) {
    $additional_markup = 'Markup to add to the page';

    $node-&gt;content['my_additional_markup'] = array(
      '#markup' =&gt; $additional_markup, 
      '#weight' =&gt; 10, 
    );
  }
}


The values in $_SESSION are the ones set by the form submission handler. mymodule_check_timestamp() should return TRUE when $_SESSION['timestamp'] doesn't contain a value too past in time; this would help in the case there is a module that redirect the user to a different page, and then the user visit the node page to review the node s/he saved. For example, it could return TRUE when $_SESSION['timestamp'] is a timestamp 5 seconds earlier. It is up to you to decide how much delay should be acceptable between when the node is saved, and when the node is viewed from the same user who edited it.

You can change the weight used in hook_node_view(); that changes where in the node view page your markup is added.